thrivekit 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/explain.md +114 -0
- package/.claude/commands/idea.md +370 -0
- package/.claude/commands/my-dna.md +122 -0
- package/.claude/commands/prd.md +286 -0
- package/.claude/commands/review.md +167 -0
- package/.claude/commands/sign.md +32 -0
- package/.claude/commands/styleguide.md +450 -0
- package/.claude/commands/tour.md +301 -0
- package/.claude/commands/vibe-check.md +116 -0
- package/.claude/commands/vibe-help.md +47 -0
- package/.claude/commands/vibe-list.md +203 -0
- package/.claude/settings.json +75 -0
- package/.claude/settings.local.json +12 -0
- package/.pre-commit-hooks.yaml +102 -0
- package/LICENSE +21 -0
- package/README.md +214 -0
- package/bin/postinstall.sh +29 -0
- package/bin/ralph.sh +171 -0
- package/bin/thrivekit.sh +24 -0
- package/bin/vibe-check.js +19 -0
- package/dist/checks/check-any-types.d.ts +6 -0
- package/dist/checks/check-any-types.d.ts.map +1 -0
- package/dist/checks/check-any-types.js +73 -0
- package/dist/checks/check-any-types.js.map +1 -0
- package/dist/checks/check-commented-code.d.ts +6 -0
- package/dist/checks/check-commented-code.d.ts.map +1 -0
- package/dist/checks/check-commented-code.js +81 -0
- package/dist/checks/check-commented-code.js.map +1 -0
- package/dist/checks/check-console-error.d.ts +6 -0
- package/dist/checks/check-console-error.d.ts.map +1 -0
- package/dist/checks/check-console-error.js +41 -0
- package/dist/checks/check-console-error.js.map +1 -0
- package/dist/checks/check-debug-statements.d.ts +6 -0
- package/dist/checks/check-debug-statements.d.ts.map +1 -0
- package/dist/checks/check-debug-statements.js +120 -0
- package/dist/checks/check-debug-statements.js.map +1 -0
- package/dist/checks/check-deep-nesting.d.ts +6 -0
- package/dist/checks/check-deep-nesting.d.ts.map +1 -0
- package/dist/checks/check-deep-nesting.js +116 -0
- package/dist/checks/check-deep-nesting.js.map +1 -0
- package/dist/checks/check-docker-platform.d.ts +6 -0
- package/dist/checks/check-docker-platform.d.ts.map +1 -0
- package/dist/checks/check-docker-platform.js +42 -0
- package/dist/checks/check-docker-platform.js.map +1 -0
- package/dist/checks/check-dry-violations.d.ts +6 -0
- package/dist/checks/check-dry-violations.d.ts.map +1 -0
- package/dist/checks/check-dry-violations.js +124 -0
- package/dist/checks/check-dry-violations.js.map +1 -0
- package/dist/checks/check-empty-catch.d.ts +6 -0
- package/dist/checks/check-empty-catch.d.ts.map +1 -0
- package/dist/checks/check-empty-catch.js +111 -0
- package/dist/checks/check-empty-catch.js.map +1 -0
- package/dist/checks/check-function-length.d.ts +6 -0
- package/dist/checks/check-function-length.d.ts.map +1 -0
- package/dist/checks/check-function-length.js +152 -0
- package/dist/checks/check-function-length.js.map +1 -0
- package/dist/checks/check-hardcoded-ai-models.d.ts +10 -0
- package/dist/checks/check-hardcoded-ai-models.d.ts.map +1 -0
- package/dist/checks/check-hardcoded-ai-models.js +102 -0
- package/dist/checks/check-hardcoded-ai-models.js.map +1 -0
- package/dist/checks/check-hardcoded-urls.d.ts +6 -0
- package/dist/checks/check-hardcoded-urls.d.ts.map +1 -0
- package/dist/checks/check-hardcoded-urls.js +124 -0
- package/dist/checks/check-hardcoded-urls.js.map +1 -0
- package/dist/checks/check-magic-numbers.d.ts +6 -0
- package/dist/checks/check-magic-numbers.d.ts.map +1 -0
- package/dist/checks/check-magic-numbers.js +116 -0
- package/dist/checks/check-magic-numbers.js.map +1 -0
- package/dist/checks/check-secrets.d.ts +6 -0
- package/dist/checks/check-secrets.d.ts.map +1 -0
- package/dist/checks/check-secrets.js +138 -0
- package/dist/checks/check-secrets.js.map +1 -0
- package/dist/checks/check-snake-case-ts.d.ts +6 -0
- package/dist/checks/check-snake-case-ts.d.ts.map +1 -0
- package/dist/checks/check-snake-case-ts.js +78 -0
- package/dist/checks/check-snake-case-ts.js.map +1 -0
- package/dist/checks/check-todo-fixme.d.ts +6 -0
- package/dist/checks/check-todo-fixme.d.ts.map +1 -0
- package/dist/checks/check-todo-fixme.js +41 -0
- package/dist/checks/check-todo-fixme.js.map +1 -0
- package/dist/checks/check-unsafe-html.d.ts +6 -0
- package/dist/checks/check-unsafe-html.d.ts.map +1 -0
- package/dist/checks/check-unsafe-html.js +101 -0
- package/dist/checks/check-unsafe-html.js.map +1 -0
- package/dist/checks/index.d.ts +30 -0
- package/dist/checks/index.d.ts.map +1 -0
- package/dist/checks/index.js +57 -0
- package/dist/checks/index.js.map +1 -0
- package/dist/cli.d.ts +13 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +206 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/file-reader.d.ts +24 -0
- package/dist/utils/file-reader.d.ts.map +1 -0
- package/dist/utils/file-reader.js +140 -0
- package/dist/utils/file-reader.js.map +1 -0
- package/dist/utils/patterns.d.ts +27 -0
- package/dist/utils/patterns.d.ts.map +1 -0
- package/dist/utils/patterns.js +84 -0
- package/dist/utils/patterns.js.map +1 -0
- package/dist/utils/reporters.d.ts +21 -0
- package/dist/utils/reporters.d.ts.map +1 -0
- package/dist/utils/reporters.js +115 -0
- package/dist/utils/reporters.js.map +1 -0
- package/dist/utils/types.d.ts +71 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +5 -0
- package/dist/utils/types.js.map +1 -0
- package/package.json +82 -0
- package/ralph/api.sh +210 -0
- package/ralph/backup.sh +838 -0
- package/ralph/browser-verify/README.md +135 -0
- package/ralph/browser-verify/verify.ts +450 -0
- package/ralph/checks/check-fastapi-responses.py +155 -0
- package/ralph/hooks/hooks-config.json +72 -0
- package/ralph/hooks/inject-context.sh +44 -0
- package/ralph/hooks/install.sh +207 -0
- package/ralph/hooks/log-tools.sh +45 -0
- package/ralph/hooks/protect-prd.sh +27 -0
- package/ralph/hooks/save-learnings.sh +36 -0
- package/ralph/hooks/warn-debug.sh +54 -0
- package/ralph/hooks/warn-empty-catch.sh +63 -0
- package/ralph/hooks/warn-secrets.sh +89 -0
- package/ralph/hooks/warn-urls.sh +77 -0
- package/ralph/init.sh +388 -0
- package/ralph/loop.sh +570 -0
- package/ralph/playwright.sh +238 -0
- package/ralph/prd.sh +295 -0
- package/ralph/setup/feature-tour.sh +155 -0
- package/ralph/setup/quick-setup.sh +239 -0
- package/ralph/setup/tutorial.sh +159 -0
- package/ralph/setup/ui.sh +136 -0
- package/ralph/setup.sh +353 -0
- package/ralph/signs.sh +150 -0
- package/ralph/utils.sh +682 -0
- package/ralph/verify/browser.sh +324 -0
- package/ralph/verify/lint.sh +363 -0
- package/ralph/verify/review.sh +164 -0
- package/ralph/verify/tests.sh +81 -0
- package/ralph/verify.sh +224 -0
- package/templates/PROMPT.md +235 -0
- package/templates/config/fullstack.json +86 -0
- package/templates/config/go.json +81 -0
- package/templates/config/minimal.json +76 -0
- package/templates/config/node.json +81 -0
- package/templates/config/python.json +81 -0
- package/templates/config/rust.json +81 -0
- package/templates/examples/CLAUDE-django.md +174 -0
- package/templates/examples/CLAUDE-fastapi.md +270 -0
- package/templates/examples/CLAUDE-fastmcp.md +352 -0
- package/templates/examples/CLAUDE-fullstack.md +256 -0
- package/templates/examples/CLAUDE-node.md +246 -0
- package/templates/examples/CLAUDE-react.md +138 -0
- package/templates/optional/cursorrules.template +147 -0
- package/templates/optional/eslint.config.js +34 -0
- package/templates/optional/lint-staged.config.js +34 -0
- package/templates/optional/ruff.toml +125 -0
- package/templates/optional/vibe-check.yml +116 -0
- package/templates/optional/vscode-settings.json +127 -0
- package/templates/signs.json +46 -0
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate a complete HTML/React styleguide page for your project based on your design preferences.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Styleguide Generator
|
|
6
|
+
|
|
7
|
+
Generate a complete HTML/React styleguide page for your project based on your design preferences.
|
|
8
|
+
|
|
9
|
+
## Instructions
|
|
10
|
+
|
|
11
|
+
This skill creates a `/styleguide` route that displays all your UI components, making it easy for AI to understand and replicate your design system.
|
|
12
|
+
|
|
13
|
+
### Phase 1: Discovery
|
|
14
|
+
|
|
15
|
+
First, understand the project:
|
|
16
|
+
|
|
17
|
+
**Check the tech stack:**
|
|
18
|
+
- Look for `package.json` to identify the framework (React, Vue, Next.js, etc.)
|
|
19
|
+
- Check for existing styling solution (Tailwind, CSS Modules, styled-components, etc.)
|
|
20
|
+
- Find the components directory structure
|
|
21
|
+
- Look for any existing design tokens or theme files
|
|
22
|
+
|
|
23
|
+
**Check for existing components:**
|
|
24
|
+
- Search for `components/` or `src/components/`
|
|
25
|
+
- Look for existing Button, Input, Card components
|
|
26
|
+
- Note any UI library usage (shadcn, MUI, Chakra, etc.)
|
|
27
|
+
|
|
28
|
+
### Phase 2: Interview the User
|
|
29
|
+
|
|
30
|
+
Ask these questions to understand their design vision. Present them as a friendly conversation:
|
|
31
|
+
|
|
32
|
+
**1. "What's the vibe you're going for?"**
|
|
33
|
+
|
|
34
|
+
Offer examples:
|
|
35
|
+
- **Clean & Minimal** - Lots of whitespace, subtle shadows, muted colors
|
|
36
|
+
- **Bold & Vibrant** - Saturated colors, strong contrasts, energetic
|
|
37
|
+
- **Dark & Moody** - Dark backgrounds, neon accents, atmospheric
|
|
38
|
+
- **Soft & Friendly** - Rounded corners, pastels, warm feeling
|
|
39
|
+
- **Professional & Corporate** - Conservative, trustworthy, structured
|
|
40
|
+
- **Playful & Fun** - Bright colors, animations, personality
|
|
41
|
+
- **Neon Glass** - Glassmorphism, glows, futuristic
|
|
42
|
+
- **Other** - Let them describe it
|
|
43
|
+
|
|
44
|
+
**2. "What are your brand colors?"**
|
|
45
|
+
|
|
46
|
+
Ask for:
|
|
47
|
+
- **Primary color** - Main brand color (buttons, links, accents)
|
|
48
|
+
- **Secondary color** - Supporting color
|
|
49
|
+
- **Accent color** - For highlights and CTAs (optional)
|
|
50
|
+
|
|
51
|
+
If they don't have colors, suggest palettes based on their vibe:
|
|
52
|
+
- Clean: Blue (#3B82F6) + Gray
|
|
53
|
+
- Bold: Orange (#F97316) + Purple (#8B5CF6)
|
|
54
|
+
- Dark: Cyan (#06B6D4) + Purple (#A855F7)
|
|
55
|
+
- Soft: Pink (#EC4899) + Lavender (#A78BFA)
|
|
56
|
+
- Professional: Navy (#1E40AF) + Gold (#F59E0B)
|
|
57
|
+
|
|
58
|
+
**3. "Light mode, dark mode, or both?"**
|
|
59
|
+
|
|
60
|
+
- Light mode only
|
|
61
|
+
- Dark mode only
|
|
62
|
+
- Both (with toggle)
|
|
63
|
+
|
|
64
|
+
**4. "What's your border radius preference?"**
|
|
65
|
+
|
|
66
|
+
- **Sharp** - 0px (modern, editorial)
|
|
67
|
+
- **Subtle** - 4px (clean, professional)
|
|
68
|
+
- **Rounded** - 8px (friendly, approachable)
|
|
69
|
+
- **Pill** - 9999px for buttons (playful)
|
|
70
|
+
- **Mixed** - Rounded cards, pill buttons
|
|
71
|
+
|
|
72
|
+
**5. "Any specific components you need?"**
|
|
73
|
+
|
|
74
|
+
Common ones to include:
|
|
75
|
+
- Buttons (primary, secondary, ghost, destructive)
|
|
76
|
+
- Form inputs (text, select, checkbox, radio, toggle)
|
|
77
|
+
- Cards
|
|
78
|
+
- Modals/Dialogs
|
|
79
|
+
- Alerts/Toasts
|
|
80
|
+
- Navigation
|
|
81
|
+
- Tables
|
|
82
|
+
- Badges/Tags
|
|
83
|
+
|
|
84
|
+
### Phase 3: Generate the Styleguide
|
|
85
|
+
|
|
86
|
+
Create a styleguide page at `/styleguide` (or their preferred route).
|
|
87
|
+
|
|
88
|
+
**File structure for React/Next.js:**
|
|
89
|
+
```
|
|
90
|
+
src/
|
|
91
|
+
├── pages/styleguide.tsx (or app/styleguide/page.tsx for Next.js App Router)
|
|
92
|
+
└── styles/
|
|
93
|
+
└── design-tokens.css (optional CSS variables)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Include these sections:**
|
|
97
|
+
|
|
98
|
+
#### 1. Design Tokens
|
|
99
|
+
```tsx
|
|
100
|
+
<section id="tokens">
|
|
101
|
+
<h2>Design Tokens</h2>
|
|
102
|
+
|
|
103
|
+
{/* Colors */}
|
|
104
|
+
<div className="grid grid-cols-5 gap-4">
|
|
105
|
+
<div className="h-20 rounded-lg bg-primary" title="Primary" />
|
|
106
|
+
<div className="h-20 rounded-lg bg-secondary" title="Secondary" />
|
|
107
|
+
<div className="h-20 rounded-lg bg-accent" title="Accent" />
|
|
108
|
+
<div className="h-20 rounded-lg bg-background" title="Background" />
|
|
109
|
+
<div className="h-20 rounded-lg bg-foreground" title="Foreground" />
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
{/* Typography Scale */}
|
|
113
|
+
<div className="space-y-2 mt-8">
|
|
114
|
+
<p className="text-xs">xs - 12px</p>
|
|
115
|
+
<p className="text-sm">sm - 14px</p>
|
|
116
|
+
<p className="text-base">base - 16px</p>
|
|
117
|
+
<p className="text-lg">lg - 18px</p>
|
|
118
|
+
<p className="text-xl">xl - 20px</p>
|
|
119
|
+
<p className="text-2xl">2xl - 24px</p>
|
|
120
|
+
<p className="text-3xl">3xl - 30px</p>
|
|
121
|
+
<p className="text-4xl">4xl - 36px</p>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
{/* Spacing */}
|
|
125
|
+
<div className="flex items-end gap-2 mt-8">
|
|
126
|
+
<div className="w-1 h-1 bg-primary" title="1 - 4px" />
|
|
127
|
+
<div className="w-2 h-2 bg-primary" title="2 - 8px" />
|
|
128
|
+
<div className="w-3 h-3 bg-primary" title="3 - 12px" />
|
|
129
|
+
<div className="w-4 h-4 bg-primary" title="4 - 16px" />
|
|
130
|
+
<div className="w-6 h-6 bg-primary" title="6 - 24px" />
|
|
131
|
+
<div className="w-8 h-8 bg-primary" title="8 - 32px" />
|
|
132
|
+
</div>
|
|
133
|
+
</section>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### 2. Buttons
|
|
137
|
+
```tsx
|
|
138
|
+
<section id="buttons">
|
|
139
|
+
<h2>Buttons</h2>
|
|
140
|
+
|
|
141
|
+
{/* Variants */}
|
|
142
|
+
<div className="flex flex-wrap gap-4">
|
|
143
|
+
<Button variant="primary">Primary</Button>
|
|
144
|
+
<Button variant="secondary">Secondary</Button>
|
|
145
|
+
<Button variant="ghost">Ghost</Button>
|
|
146
|
+
<Button variant="destructive">Destructive</Button>
|
|
147
|
+
<Button variant="link">Link</Button>
|
|
148
|
+
</div>
|
|
149
|
+
|
|
150
|
+
{/* Sizes */}
|
|
151
|
+
<div className="flex items-center gap-4 mt-4">
|
|
152
|
+
<Button size="sm">Small</Button>
|
|
153
|
+
<Button size="md">Medium</Button>
|
|
154
|
+
<Button size="lg">Large</Button>
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
{/* States */}
|
|
158
|
+
<div className="flex flex-wrap gap-4 mt-4">
|
|
159
|
+
<Button>Default</Button>
|
|
160
|
+
<Button disabled>Disabled</Button>
|
|
161
|
+
<Button loading>Loading</Button>
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
{/* With Icons */}
|
|
165
|
+
<div className="flex gap-4 mt-4">
|
|
166
|
+
<Button><PlusIcon /> Add Item</Button>
|
|
167
|
+
<Button>Next <ArrowRightIcon /></Button>
|
|
168
|
+
<Button size="icon"><SearchIcon /></Button>
|
|
169
|
+
</div>
|
|
170
|
+
</section>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
#### 3. Form Inputs
|
|
174
|
+
```tsx
|
|
175
|
+
<section id="forms">
|
|
176
|
+
<h2>Form Inputs</h2>
|
|
177
|
+
|
|
178
|
+
{/* Text Inputs */}
|
|
179
|
+
<div className="space-y-4 max-w-md">
|
|
180
|
+
<Input label="Default" placeholder="Enter text..." />
|
|
181
|
+
<Input label="With value" value="Hello world" />
|
|
182
|
+
<Input label="Disabled" disabled value="Can't edit" />
|
|
183
|
+
<Input label="With error" error="This field is required" />
|
|
184
|
+
<Input label="With helper" helper="We'll never share your email" />
|
|
185
|
+
</div>
|
|
186
|
+
|
|
187
|
+
{/* Select */}
|
|
188
|
+
<Select label="Choose option">
|
|
189
|
+
<option>Option 1</option>
|
|
190
|
+
<option>Option 2</option>
|
|
191
|
+
<option>Option 3</option>
|
|
192
|
+
</Select>
|
|
193
|
+
|
|
194
|
+
{/* Checkbox & Radio */}
|
|
195
|
+
<div className="space-y-2 mt-4">
|
|
196
|
+
<Checkbox label="Accept terms" />
|
|
197
|
+
<Checkbox label="Checked" checked />
|
|
198
|
+
<Checkbox label="Disabled" disabled />
|
|
199
|
+
</div>
|
|
200
|
+
|
|
201
|
+
{/* Toggle */}
|
|
202
|
+
<div className="flex gap-4 mt-4">
|
|
203
|
+
<Toggle label="Off" />
|
|
204
|
+
<Toggle label="On" checked />
|
|
205
|
+
</div>
|
|
206
|
+
</section>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
#### 4. Cards
|
|
210
|
+
```tsx
|
|
211
|
+
<section id="cards">
|
|
212
|
+
<h2>Cards</h2>
|
|
213
|
+
|
|
214
|
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
|
215
|
+
{/* Basic Card */}
|
|
216
|
+
<Card>
|
|
217
|
+
<CardHeader>
|
|
218
|
+
<CardTitle>Card Title</CardTitle>
|
|
219
|
+
<CardDescription>Card description goes here</CardDescription>
|
|
220
|
+
</CardHeader>
|
|
221
|
+
<CardContent>
|
|
222
|
+
<p>Card content with some text.</p>
|
|
223
|
+
</CardContent>
|
|
224
|
+
</Card>
|
|
225
|
+
|
|
226
|
+
{/* Card with Image */}
|
|
227
|
+
<Card>
|
|
228
|
+
<img src="/placeholder.jpg" className="w-full h-40 object-cover" />
|
|
229
|
+
<CardContent>
|
|
230
|
+
<h3>Image Card</h3>
|
|
231
|
+
<p>Card with image header</p>
|
|
232
|
+
</CardContent>
|
|
233
|
+
</Card>
|
|
234
|
+
|
|
235
|
+
{/* Interactive Card */}
|
|
236
|
+
<Card hover clickable>
|
|
237
|
+
<CardContent>
|
|
238
|
+
<h3>Interactive</h3>
|
|
239
|
+
<p>Hover and click states</p>
|
|
240
|
+
</CardContent>
|
|
241
|
+
</Card>
|
|
242
|
+
</div>
|
|
243
|
+
</section>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
#### 5. Feedback Components
|
|
247
|
+
```tsx
|
|
248
|
+
<section id="feedback">
|
|
249
|
+
<h2>Feedback</h2>
|
|
250
|
+
|
|
251
|
+
{/* Alerts */}
|
|
252
|
+
<div className="space-y-4">
|
|
253
|
+
<Alert variant="info">This is an info message</Alert>
|
|
254
|
+
<Alert variant="success">Success! Your changes were saved.</Alert>
|
|
255
|
+
<Alert variant="warning">Warning: This action cannot be undone.</Alert>
|
|
256
|
+
<Alert variant="error">Error: Something went wrong.</Alert>
|
|
257
|
+
</div>
|
|
258
|
+
|
|
259
|
+
{/* Badges */}
|
|
260
|
+
<div className="flex gap-2 mt-6">
|
|
261
|
+
<Badge>Default</Badge>
|
|
262
|
+
<Badge variant="success">Success</Badge>
|
|
263
|
+
<Badge variant="warning">Warning</Badge>
|
|
264
|
+
<Badge variant="error">Error</Badge>
|
|
265
|
+
</div>
|
|
266
|
+
|
|
267
|
+
{/* Loading States */}
|
|
268
|
+
<div className="flex gap-4 mt-6">
|
|
269
|
+
<Spinner size="sm" />
|
|
270
|
+
<Spinner size="md" />
|
|
271
|
+
<Spinner size="lg" />
|
|
272
|
+
<Skeleton className="h-4 w-32" />
|
|
273
|
+
<Skeleton className="h-10 w-full" />
|
|
274
|
+
</div>
|
|
275
|
+
</section>
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Phase 4: Generate Component Files
|
|
279
|
+
|
|
280
|
+
If components don't exist yet, create them based on the user's preferences.
|
|
281
|
+
|
|
282
|
+
**Example Button component (Tailwind + React):**
|
|
283
|
+
```tsx
|
|
284
|
+
// src/components/ui/Button.tsx
|
|
285
|
+
import { forwardRef } from 'react';
|
|
286
|
+
import { cn } from '@/lib/utils';
|
|
287
|
+
|
|
288
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
289
|
+
variant?: 'primary' | 'secondary' | 'ghost' | 'destructive' | 'link';
|
|
290
|
+
size?: 'sm' | 'md' | 'lg' | 'icon';
|
|
291
|
+
loading?: boolean;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
295
|
+
({ className, variant = 'primary', size = 'md', loading, children, disabled, ...props }, ref) => {
|
|
296
|
+
return (
|
|
297
|
+
<button
|
|
298
|
+
ref={ref}
|
|
299
|
+
disabled={disabled || loading}
|
|
300
|
+
className={cn(
|
|
301
|
+
// Base styles
|
|
302
|
+
'inline-flex items-center justify-center font-medium transition-colors',
|
|
303
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2',
|
|
304
|
+
'disabled:pointer-events-none disabled:opacity-50',
|
|
305
|
+
|
|
306
|
+
// Variants (customize based on user's vibe)
|
|
307
|
+
{
|
|
308
|
+
'bg-primary text-primary-foreground hover:bg-primary/90': variant === 'primary',
|
|
309
|
+
'bg-secondary text-secondary-foreground hover:bg-secondary/80': variant === 'secondary',
|
|
310
|
+
'hover:bg-accent hover:text-accent-foreground': variant === 'ghost',
|
|
311
|
+
'bg-destructive text-destructive-foreground hover:bg-destructive/90': variant === 'destructive',
|
|
312
|
+
'text-primary underline-offset-4 hover:underline': variant === 'link',
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
// Sizes
|
|
316
|
+
{
|
|
317
|
+
'h-8 px-3 text-sm rounded-md': size === 'sm',
|
|
318
|
+
'h-10 px-4 text-sm rounded-md': size === 'md',
|
|
319
|
+
'h-12 px-6 text-base rounded-lg': size === 'lg',
|
|
320
|
+
'h-10 w-10 rounded-md': size === 'icon',
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
className
|
|
324
|
+
)}
|
|
325
|
+
{...props}
|
|
326
|
+
>
|
|
327
|
+
{loading ? <Spinner className="mr-2" size="sm" /> : null}
|
|
328
|
+
{children}
|
|
329
|
+
</button>
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
);
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### Phase 5: Add CSS Variables
|
|
336
|
+
|
|
337
|
+
Create design tokens as CSS variables for easy theming:
|
|
338
|
+
|
|
339
|
+
```css
|
|
340
|
+
/* src/styles/design-tokens.css */
|
|
341
|
+
:root {
|
|
342
|
+
/* Colors - Light Mode */
|
|
343
|
+
--color-primary: 59 130 246; /* blue-500 */
|
|
344
|
+
--color-secondary: 100 116 139; /* slate-500 */
|
|
345
|
+
--color-accent: 168 85 247; /* purple-500 */
|
|
346
|
+
--color-background: 255 255 255; /* white */
|
|
347
|
+
--color-foreground: 15 23 42; /* slate-900 */
|
|
348
|
+
--color-muted: 241 245 249; /* slate-100 */
|
|
349
|
+
--color-border: 226 232 240; /* slate-200 */
|
|
350
|
+
|
|
351
|
+
/* Feedback Colors */
|
|
352
|
+
--color-success: 34 197 94; /* green-500 */
|
|
353
|
+
--color-warning: 234 179 8; /* yellow-500 */
|
|
354
|
+
--color-error: 239 68 68; /* red-500 */
|
|
355
|
+
--color-info: 59 130 246; /* blue-500 */
|
|
356
|
+
|
|
357
|
+
/* Spacing */
|
|
358
|
+
--spacing-unit: 4px;
|
|
359
|
+
|
|
360
|
+
/* Border Radius */
|
|
361
|
+
--radius-sm: 4px;
|
|
362
|
+
--radius-md: 8px;
|
|
363
|
+
--radius-lg: 12px;
|
|
364
|
+
--radius-full: 9999px;
|
|
365
|
+
|
|
366
|
+
/* Shadows */
|
|
367
|
+
--shadow-sm: 0 1px 2px rgb(0 0 0 / 0.05);
|
|
368
|
+
--shadow-md: 0 4px 6px rgb(0 0 0 / 0.1);
|
|
369
|
+
--shadow-lg: 0 10px 15px rgb(0 0 0 / 0.1);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/* Dark Mode */
|
|
373
|
+
.dark {
|
|
374
|
+
--color-background: 15 23 42; /* slate-900 */
|
|
375
|
+
--color-foreground: 248 250 252; /* slate-50 */
|
|
376
|
+
--color-muted: 30 41 59; /* slate-800 */
|
|
377
|
+
--color-border: 51 65 85; /* slate-700 */
|
|
378
|
+
}
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### Phase 6: Update CLAUDE.md
|
|
382
|
+
|
|
383
|
+
Add the styleguide reference to the project's CLAUDE.md:
|
|
384
|
+
|
|
385
|
+
```markdown
|
|
386
|
+
## Design System
|
|
387
|
+
|
|
388
|
+
Reference `/styleguide` for all UI components and design tokens.
|
|
389
|
+
|
|
390
|
+
### Quick Reference
|
|
391
|
+
- Primary: [color]
|
|
392
|
+
- Border Radius: [preference]
|
|
393
|
+
- Mode: [light/dark/both]
|
|
394
|
+
|
|
395
|
+
### Components
|
|
396
|
+
Use components from `@/components/ui`:
|
|
397
|
+
- Button, Input, Select, Checkbox, Toggle
|
|
398
|
+
- Card, Alert, Badge, Modal
|
|
399
|
+
- All variants shown in /styleguide
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
### Vibe-Specific Templates
|
|
403
|
+
|
|
404
|
+
**Neon Glass:**
|
|
405
|
+
```tsx
|
|
406
|
+
// Dark background with glassmorphism
|
|
407
|
+
<div className="bg-black min-h-screen">
|
|
408
|
+
<Card className="
|
|
409
|
+
bg-white/5 backdrop-blur-xl
|
|
410
|
+
border border-white/10
|
|
411
|
+
shadow-[0_0_30px_rgba(0,255,255,0.1)]
|
|
412
|
+
">
|
|
413
|
+
<h2 className="text-transparent bg-clip-text bg-gradient-to-r from-cyan-400 to-purple-500">
|
|
414
|
+
Neon Glass
|
|
415
|
+
</h2>
|
|
416
|
+
</Card>
|
|
417
|
+
</div>
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
**Clean & Minimal:**
|
|
421
|
+
```tsx
|
|
422
|
+
// Lots of whitespace, subtle shadows
|
|
423
|
+
<div className="bg-gray-50 min-h-screen p-12">
|
|
424
|
+
<Card className="bg-white shadow-sm border border-gray-100 rounded-lg">
|
|
425
|
+
<h2 className="text-gray-900 font-light tracking-tight">
|
|
426
|
+
Clean & Minimal
|
|
427
|
+
</h2>
|
|
428
|
+
</Card>
|
|
429
|
+
</div>
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
**Bold & Vibrant:**
|
|
433
|
+
```tsx
|
|
434
|
+
// Strong colors, high contrast
|
|
435
|
+
<div className="bg-gradient-to-br from-orange-500 to-pink-600 min-h-screen">
|
|
436
|
+
<Card className="bg-white rounded-2xl shadow-2xl">
|
|
437
|
+
<h2 className="text-3xl font-black text-gray-900">
|
|
438
|
+
Bold & Vibrant
|
|
439
|
+
</h2>
|
|
440
|
+
</Card>
|
|
441
|
+
</div>
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
## Notes
|
|
445
|
+
|
|
446
|
+
- Always create components that match the user's chosen vibe
|
|
447
|
+
- Include all states (hover, active, focus, disabled, loading)
|
|
448
|
+
- Make the styleguide itself match the design system
|
|
449
|
+
- Add code snippets so developers can copy usage examples
|
|
450
|
+
- Test in both light and dark mode if applicable
|