|
1 | 1 | import { useThemeStore } from '@/lib/theme/store'; |
2 | 2 | import { tokenValueToCss } from '@/lib/theme/color'; |
3 | | -import { Badge } from '@/components/ui/badge'; |
4 | 3 | import { Button } from '@/components/ui/button'; |
5 | | -import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'; |
6 | | -import { Input } from '@/components/ui/input'; |
7 | | -import { Label } from '@/components/ui/label'; |
8 | 4 | import { Sun, Moon } from 'lucide-react'; |
9 | 5 | import { useMemo, useState } from 'react'; |
| 6 | +import CardsPreview from '@/components/preview/cards-preview'; |
10 | 7 |
|
11 | 8 | const COLOR_TOKENS = [ |
12 | 9 | 'background', 'foreground', |
@@ -68,93 +65,38 @@ export function ThemePreview() { |
68 | 65 |
|
69 | 66 | return ( |
70 | 67 | <div className="flex h-full flex-col"> |
71 | | - <div className="flex items-center justify-between border-b px-4 py-2" style={{ borderColor: 'var(--color-border)' }}> |
72 | | - <span className="text-sm font-medium text-muted-foreground">Preview</span> |
| 68 | + <div |
| 69 | + className="flex items-center justify-between border-b px-4 py-2" |
| 70 | + style={{ borderColor: 'var(--color-border)' }} |
| 71 | + > |
| 72 | + <span className="text-sm font-medium text-muted-foreground"> |
| 73 | + Preview |
| 74 | + </span> |
73 | 75 | <Button variant="outline" size="sm" onClick={toggleMode}> |
74 | 76 | {previewMode === 'light' ? ( |
75 | | - <><Moon className="mr-1 size-3.5" /> Dark</> |
| 77 | + <> |
| 78 | + <Moon className="mr-1 size-3.5" /> Dark |
| 79 | + </> |
76 | 80 | ) : ( |
77 | | - <><Sun className="mr-1 size-3.5" /> Light</> |
| 81 | + <> |
| 82 | + <Sun className="mr-1 size-3.5" /> Light |
| 83 | + </> |
78 | 84 | )} |
79 | 85 | </Button> |
80 | 86 | </div> |
81 | 87 |
|
82 | 88 | <div |
83 | 89 | className="flex-1 overflow-y-auto" |
84 | | - style={{ background: bgCss, color: fgCss } as React.CSSProperties} |
| 90 | + style={ |
| 91 | + { |
| 92 | + background: bgCss, |
| 93 | + color: fgCss, |
| 94 | + ...cssVars, |
| 95 | + } as React.CSSProperties |
| 96 | + } |
85 | 97 | > |
86 | | - <div className="min-h-full p-6" style={cssVars as React.CSSProperties}> |
87 | | - <p |
88 | | - className="text-2xl font-bold" |
89 | | - style={{ fontFamily: `"${fonts.serif}"` }} |
90 | | - > |
91 | | - Theme Preview |
92 | | - </p> |
93 | | - <p className="mt-1 mb-6 text-sm" style={{ color: 'var(--color-muted-foreground)' }}> |
94 | | - Sample UI components using your current palette. |
95 | | - </p> |
96 | | - |
97 | | - <div className="flex flex-wrap gap-2"> |
98 | | - <Button>Primary</Button> |
99 | | - <Button variant="secondary">Secondary</Button> |
100 | | - <Button variant="outline">Outline</Button> |
101 | | - <Button variant="ghost">Ghost</Button> |
102 | | - <Button variant="destructive">Destructive</Button> |
103 | | - </div> |
104 | | - |
105 | | - <Card className="mt-6 max-w-sm"> |
106 | | - <CardHeader> |
107 | | - <CardTitle>Example Card</CardTitle> |
108 | | - </CardHeader> |
109 | | - <CardContent> |
110 | | - <p className="text-sm" style={{ color: 'var(--color-muted-foreground)' }}> |
111 | | - This card demonstrates how your theme appears on standard |
112 | | - shadcn/ui components. |
113 | | - </p> |
114 | | - </CardContent> |
115 | | - <CardFooter className="flex justify-between"> |
116 | | - <Button variant="outline">Cancel</Button> |
117 | | - <Button>Save</Button> |
118 | | - </CardFooter> |
119 | | - </Card> |
120 | | - |
121 | | - <Card className="mt-4 max-w-sm"> |
122 | | - <CardHeader> |
123 | | - <CardTitle>Form Example</CardTitle> |
124 | | - </CardHeader> |
125 | | - <CardContent className="space-y-3"> |
126 | | - <div className="space-y-1"> |
127 | | - <Label htmlFor="pv-email">Email</Label> |
128 | | - <Input id="pv-email" placeholder="you@example.com" /> |
129 | | - </div> |
130 | | - <div className="space-y-1"> |
131 | | - <Label htmlFor="pv-pw">Password</Label> |
132 | | - <Input id="pv-pw" type="password" placeholder="••••••••" /> |
133 | | - </div> |
134 | | - </CardContent> |
135 | | - </Card> |
136 | | - |
137 | | - <div className="mt-6 flex flex-wrap gap-2"> |
138 | | - <Badge>Default</Badge> |
139 | | - <Badge variant="secondary">Secondary</Badge> |
140 | | - <Badge variant="outline">Outline</Badge> |
141 | | - <Badge variant="destructive">Destructive</Badge> |
142 | | - </div> |
143 | | - |
144 | | - <div |
145 | | - className="mt-6 rounded-lg border p-4 space-y-1" |
146 | | - style={{ borderColor: 'var(--color-border)' }} |
147 | | - > |
148 | | - <p className="font-mono text-xs" style={{ color: 'var(--color-muted-foreground)' }}> |
149 | | - SYSTEM — font-mono ({fonts.mono}) |
150 | | - </p> |
151 | | - <p style={{ fontFamily: `"${fonts.serif}"` }}> |
152 | | - The quick brown fox jumps over the lazy dog — serif |
153 | | - </p> |
154 | | - <p style={{ fontFamily: `"${fonts.sans}"` }}> |
155 | | - The quick brown fox jumps over the lazy dog — sans |
156 | | - </p> |
157 | | - </div> |
| 98 | + <div className="min-h-full p-6"> |
| 99 | + <CardsPreview /> |
158 | 100 | </div> |
159 | 101 | </div> |
160 | 102 | </div> |
|
0 commit comments