@discourser/design-system 0.22.2 → 0.22.4
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/dist/figma-codex.json +2 -2
- package/docs/CSS_USAGE.md +235 -0
- package/docs/FIGMA_MAKE_SETUP.md +339 -0
- package/docs/GUIDELINES_REVIEW.md +728 -0
- package/docs/MAINTAINER_CHECKLIST.md +265 -0
- package/docs/TESTING_QUICK_REFERENCE.md +159 -0
- package/docs/TESTING_TOKENS.md +340 -0
- package/docs/active-stories/README.md +29 -0
- package/docs/active-stories/STORY-006a-figma-translation-foundations.md +324 -0
- package/docs/active-stories/STORY-006b-figma-translation-components.md +201 -0
- package/docs/active-stories/STORY-006c-figma-translation-layout-extension.md +258 -0
- package/docs/active-stories/STORY-008-kai-sidecar-fragments.md +137 -0
- package/docs/active-stories/STORY-011-verify-translation-docs.md +182 -0
- package/docs/archive/ARCHITECTURE-discourser-design-system.md +448 -0
- package/docs/claude-feed-back/ARCHITECTURE_DIAGRAM.md +243 -0
- package/docs/claude-feed-back/STYLING_VERIFICATION.md +89 -0
- package/docs/claude-feed-back/TEST_RESULTS.md +182 -0
- package/docs/context-share/ELEVATION_FIX_PLAN.md +903 -0
- package/docs/context-share/STORY-001-VALIDATION-PASSED.md +192 -0
- package/docs/context-share/STORY-002-IMPLEMENTATION-COMPLETE.md +161 -0
- package/docs/context-share/STORYBOOK_MCP_STRATEGY.md +867 -0
- package/docs/context-share/TESTING_GAPS_FILLED.md +353 -0
- package/docs/context-share/TOKEN_TESTING_SUMMARY.md +388 -0
- package/docs/context-share/code-connect-prompt.md +90 -0
- package/docs/context-share/dds-autonomous-pipeline.md +765 -0
- package/docs/context-share/fix-checkbox-radio-tokens.md +145 -0
- package/docs/context-share/icon-component-prompt.md +154 -0
- package/docs/context-share/icons/Audience.svg +3 -0
- package/docs/context-share/icons/AudioSpeaker.svg +3 -0
- package/docs/context-share/icons/BookmarkPlus.svg +3 -0
- package/docs/context-share/icons/ClipBoard.svg +8 -0
- package/docs/context-share/icons/DiscourserLogo.svg +4 -0
- package/docs/context-share/icons/ExitStudio.svg +4 -0
- package/docs/context-share/icons/Microphone.svg +5 -0
- package/docs/context-share/icons/NotebookPen.svg +3 -0
- package/docs/context-share/icons/PausePlay.svg +5 -0
- package/docs/context-share/icons/Play.svg +4 -0
- package/docs/context-share/icons/Record.svg +6 -0
- package/docs/context-share/icons/RepeatQuestion.svg +3 -0
- package/docs/context-share/icons/ScrollText.svg +3 -0
- package/docs/context-share/icons/Sparkles.svg +3 -0
- package/docs/context-share/icons/Speech.svg +3 -0
- package/docs/context-share/icons/StopPlay.svg +4 -0
- package/docs/context-share/icons/Timer.svg +3 -0
- package/docs/context-share/icons/UserProfile.svg +3 -0
- package/docs/context-share/m3-token-pipeline-audit.md +125 -0
- package/docs/context-share/storybook-mcp-kai-agent-revised-summary.md +211 -0
- package/docs/discourser-design-system-prd.md +3698 -0
- package/docs/figma-captures/01-typography.png +0 -0
- package/docs/figma-captures/02-button-iconbutton.png +0 -0
- package/docs/figma-captures/03-form-inputs.png +0 -0
- package/docs/figma-captures/04-form-controls.png +0 -0
- package/docs/figma-captures/05-data-display.png +0 -0
- package/docs/figma-captures/06-feedback.png +0 -0
- package/docs/figma-captures/07-overlays.png +0 -0
- package/docs/figma-captures/08-navigation-layout.png +0 -0
- package/docs/figma-captures/09-custom-components.png +0 -0
- package/docs/figma-captures/10-scenario-queue.png +0 -0
- package/docs/figma-captures/11-icon-library.png +0 -0
- package/docs/figma-make-docs/01-understanding-templates.md +235 -0
- package/docs/figma-make-docs/02-prerequisites.md +266 -0
- package/docs/figma-make-docs/03-creating-template.md +306 -0
- package/docs/figma-make-docs/04-adding-guidelines.md +448 -0
- package/docs/figma-make-docs/05-example-starter-code.md +590 -0
- package/docs/figma-make-docs/06-publishing-template.md +417 -0
- package/docs/figma-make-docs/07-maintenance.md +536 -0
- package/docs/figma-make-docs/08-faq.md +490 -0
- package/docs/figma-make-docs/README.md +95 -0
- package/docs/material-theme.json +418 -0
- package/docs/plans/2026-03-12-figma-token-export-rewrite.md +504 -0
- package/docs/plans/2026-03-12-step7-panda-token-resolution-design.md +119 -0
- package/docs/plans/2026-03-12-step7-panda-token-resolution.md +993 -0
- package/docs/token-name-mapping.json +850 -0
- package/docs/token-name-mapping.md +251 -0
- package/package.json +3 -2
|
@@ -0,0 +1,590 @@
|
|
|
1
|
+
# Example Starter Code
|
|
2
|
+
|
|
3
|
+
This guide provides example components and starter code to include in your Figma Make template.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
**Purpose:** Showcase the design system and provide starting points for users
|
|
8
|
+
|
|
9
|
+
**Time Required:** 30-45 minutes
|
|
10
|
+
|
|
11
|
+
**What You'll Create:**
|
|
12
|
+
1. Enhanced App.tsx with multiple examples
|
|
13
|
+
2. Example components demonstrating patterns
|
|
14
|
+
3. README file for users
|
|
15
|
+
|
|
16
|
+
## Why Include Examples?
|
|
17
|
+
|
|
18
|
+
**Benefits of starter code:**
|
|
19
|
+
- ✅ Shows best practices
|
|
20
|
+
- ✅ Demonstrates correct component usage
|
|
21
|
+
- ✅ Provides copy/paste starting points
|
|
22
|
+
- ✅ Reduces learning curve
|
|
23
|
+
- ✅ Ensures consistency
|
|
24
|
+
|
|
25
|
+
**Users can:**
|
|
26
|
+
- See components in action
|
|
27
|
+
- Copy patterns for their own code
|
|
28
|
+
- Learn by example
|
|
29
|
+
- Get started faster
|
|
30
|
+
|
|
31
|
+
## Step 1: Create Examples Folder
|
|
32
|
+
|
|
33
|
+
### 1.1 Create Folder Structure
|
|
34
|
+
|
|
35
|
+
In Figma Make (**Code** panel):
|
|
36
|
+
1. Right-click **src/**
|
|
37
|
+
2. Select **Create new folder**
|
|
38
|
+
3. Name it: `examples`
|
|
39
|
+
|
|
40
|
+
### 1.2 Folder Purpose
|
|
41
|
+
|
|
42
|
+
This folder will contain example components that users can reference or delete:
|
|
43
|
+
```
|
|
44
|
+
src/
|
|
45
|
+
├── App.tsx # Main app with examples
|
|
46
|
+
├── main.tsx # Entry point (don't modify)
|
|
47
|
+
└── examples/ # Example components
|
|
48
|
+
├── ButtonExamples.tsx
|
|
49
|
+
├── FormExamples.tsx
|
|
50
|
+
└── LayoutExamples.tsx
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Step 2: Create Enhanced App.tsx
|
|
54
|
+
|
|
55
|
+
Replace the test code with a comprehensive example.
|
|
56
|
+
|
|
57
|
+
### 2.1 Open App.tsx
|
|
58
|
+
|
|
59
|
+
1. Click **Code** → **src/** → **App.tsx**
|
|
60
|
+
2. Select all existing content
|
|
61
|
+
3. Replace with the code below
|
|
62
|
+
|
|
63
|
+
### 2.2 App.tsx Complete Code
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
import { useState } from 'react';
|
|
67
|
+
import { Button, Card } from '@discourser/design-system';
|
|
68
|
+
import { ButtonExamples } from './examples/ButtonExamples';
|
|
69
|
+
import { FormExamples } from './examples/FormExamples';
|
|
70
|
+
import { LayoutExamples } from './examples/LayoutExamples';
|
|
71
|
+
|
|
72
|
+
export default function App() {
|
|
73
|
+
const [activeTab, setActiveTab] = useState<'buttons' | 'forms' | 'layouts'>('buttons');
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<div style={{ minHeight: '100vh', background: '#F9FAEF', padding: '2rem' }}>
|
|
77
|
+
{/* Header */}
|
|
78
|
+
<Card variant="elevated" style={{ marginBottom: '2rem' }}>
|
|
79
|
+
<div style={{ padding: '2rem' }}>
|
|
80
|
+
<h1 style={{ margin: 0, marginBottom: '0.5rem', fontSize: '2rem' }}>
|
|
81
|
+
Discourser Design System
|
|
82
|
+
</h1>
|
|
83
|
+
<p style={{ margin: 0, color: '#5E5F59' }}>
|
|
84
|
+
Material Design 3 components with Panda CSS and Ark UI
|
|
85
|
+
</p>
|
|
86
|
+
</div>
|
|
87
|
+
</Card>
|
|
88
|
+
|
|
89
|
+
{/* Tab Navigation */}
|
|
90
|
+
<div style={{ display: 'flex', gap: '0.5rem', marginBottom: '2rem' }}>
|
|
91
|
+
<Button
|
|
92
|
+
variant={activeTab === 'buttons' ? 'filled' : 'outlined'}
|
|
93
|
+
onClick={() => setActiveTab('buttons')}
|
|
94
|
+
>
|
|
95
|
+
Button Examples
|
|
96
|
+
</Button>
|
|
97
|
+
<Button
|
|
98
|
+
variant={activeTab === 'forms' ? 'filled' : 'outlined'}
|
|
99
|
+
onClick={() => setActiveTab('forms')}
|
|
100
|
+
>
|
|
101
|
+
Form Examples
|
|
102
|
+
</Button>
|
|
103
|
+
<Button
|
|
104
|
+
variant={activeTab === 'layouts' ? 'filled' : 'outlined'}
|
|
105
|
+
onClick={() => setActiveTab('layouts')}
|
|
106
|
+
>
|
|
107
|
+
Layout Examples
|
|
108
|
+
</Button>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
{/* Content */}
|
|
112
|
+
{activeTab === 'buttons' && <ButtonExamples />}
|
|
113
|
+
{activeTab === 'forms' && <FormExamples />}
|
|
114
|
+
{activeTab === 'layouts' && <LayoutExamples />}
|
|
115
|
+
|
|
116
|
+
{/* Footer */}
|
|
117
|
+
<Card variant="outlined" style={{ marginTop: '2rem' }}>
|
|
118
|
+
<div style={{ padding: '1rem', textAlign: 'center' }}>
|
|
119
|
+
<p style={{ margin: 0, fontSize: '0.875rem', color: '#777771' }}>
|
|
120
|
+
Built with @discourser/design-system • Material Design 3
|
|
121
|
+
</p>
|
|
122
|
+
</div>
|
|
123
|
+
</Card>
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 2.3 Save
|
|
130
|
+
|
|
131
|
+
Press **Cmd+S / Ctrl+S** to save.
|
|
132
|
+
|
|
133
|
+
## Step 3: Create ButtonExamples.tsx
|
|
134
|
+
|
|
135
|
+
### 3.1 Create File
|
|
136
|
+
|
|
137
|
+
1. Right-click **src/examples/**
|
|
138
|
+
2. **Create new file**
|
|
139
|
+
3. Name it: `ButtonExamples.tsx`
|
|
140
|
+
|
|
141
|
+
### 3.2 Add Content
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
import { Button, Card, IconButton } from '@discourser/design-system';
|
|
145
|
+
|
|
146
|
+
export function ButtonExamples() {
|
|
147
|
+
return (
|
|
148
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '1.5rem' }}>
|
|
149
|
+
{/* Button Variants */}
|
|
150
|
+
<Card variant="elevated">
|
|
151
|
+
<div style={{ padding: '1.5rem' }}>
|
|
152
|
+
<h2 style={{ margin: '0 0 1rem 0' }}>Button Variants</h2>
|
|
153
|
+
<div style={{ display: 'flex', gap: '0.5rem', flexWrap: 'wrap' }}>
|
|
154
|
+
<Button variant="filled">Filled</Button>
|
|
155
|
+
<Button variant="outlined">Outlined</Button>
|
|
156
|
+
<Button variant="text">Text</Button>
|
|
157
|
+
<Button variant="elevated">Elevated</Button>
|
|
158
|
+
<Button variant="tonal">Tonal</Button>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
</Card>
|
|
162
|
+
|
|
163
|
+
{/* Button Sizes */}
|
|
164
|
+
<Card variant="elevated">
|
|
165
|
+
<div style={{ padding: '1.5rem' }}>
|
|
166
|
+
<h2 style={{ margin: '0 0 1rem 0' }}>Button Sizes</h2>
|
|
167
|
+
<div style={{ display: 'flex', gap: '0.5rem', alignItems: 'center', flexWrap: 'wrap' }}>
|
|
168
|
+
<Button size="sm">Small</Button>
|
|
169
|
+
<Button size="md">Medium</Button>
|
|
170
|
+
<Button size="lg">Large</Button>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
</Card>
|
|
174
|
+
|
|
175
|
+
{/* Button States */}
|
|
176
|
+
<Card variant="elevated">
|
|
177
|
+
<div style={{ padding: '1.5rem' }}>
|
|
178
|
+
<h2 style={{ margin: '0 0 1rem 0' }}>Button States</h2>
|
|
179
|
+
<div style={{ display: 'flex', gap: '0.5rem', flexWrap: 'wrap' }}>
|
|
180
|
+
<Button variant="filled">Default</Button>
|
|
181
|
+
<Button variant="filled" disabled>
|
|
182
|
+
Disabled
|
|
183
|
+
</Button>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
</Card>
|
|
187
|
+
|
|
188
|
+
{/* Icon Buttons */}
|
|
189
|
+
<Card variant="elevated">
|
|
190
|
+
<div style={{ padding: '1.5rem' }}>
|
|
191
|
+
<h2 style={{ margin: '0 0 1rem 0' }}>Icon Buttons</h2>
|
|
192
|
+
<p style={{ margin: '0 0 1rem 0', color: '#5E5F59', fontSize: '0.875rem' }}>
|
|
193
|
+
Note: Replace with your icon library
|
|
194
|
+
</p>
|
|
195
|
+
<div style={{ display: 'flex', gap: '0.5rem', flexWrap: 'wrap' }}>
|
|
196
|
+
<IconButton variant="standard" aria-label="Menu">
|
|
197
|
+
☰
|
|
198
|
+
</IconButton>
|
|
199
|
+
<IconButton variant="filled" aria-label="Close">
|
|
200
|
+
✕
|
|
201
|
+
</IconButton>
|
|
202
|
+
<IconButton variant="tonal" aria-label="Settings">
|
|
203
|
+
⚙
|
|
204
|
+
</IconButton>
|
|
205
|
+
<IconButton variant="outlined" aria-label="Info">
|
|
206
|
+
ⓘ
|
|
207
|
+
</IconButton>
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
</Card>
|
|
211
|
+
</div>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Step 4: Create FormExamples.tsx
|
|
217
|
+
|
|
218
|
+
### 4.1 Create File
|
|
219
|
+
|
|
220
|
+
1. Right-click **src/examples/**
|
|
221
|
+
2. **Create new file**
|
|
222
|
+
3. Name it: `FormExamples.tsx`
|
|
223
|
+
|
|
224
|
+
### 4.2 Add Content
|
|
225
|
+
|
|
226
|
+
```tsx
|
|
227
|
+
import { useState } from 'react';
|
|
228
|
+
import { Button, Card, Input, Switch } from '@discourser/design-system';
|
|
229
|
+
|
|
230
|
+
export function FormExamples() {
|
|
231
|
+
const [formData, setFormData] = useState({
|
|
232
|
+
email: '',
|
|
233
|
+
password: '',
|
|
234
|
+
notifications: false,
|
|
235
|
+
});
|
|
236
|
+
const [submitted, setSubmitted] = useState(false);
|
|
237
|
+
|
|
238
|
+
const handleSubmit = (e: React.FormEvent) => {
|
|
239
|
+
e.preventDefault();
|
|
240
|
+
setSubmitted(true);
|
|
241
|
+
setTimeout(() => setSubmitted(false), 3000);
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
return (
|
|
245
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '1.5rem' }}>
|
|
246
|
+
{/* Login Form */}
|
|
247
|
+
<Card variant="elevated">
|
|
248
|
+
<div style={{ padding: '1.5rem' }}>
|
|
249
|
+
<h2 style={{ margin: '0 0 1rem 0' }}>Login Form Example</h2>
|
|
250
|
+
<form onSubmit={handleSubmit} style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
|
|
251
|
+
<Input
|
|
252
|
+
label="Email"
|
|
253
|
+
type="email"
|
|
254
|
+
value={formData.email}
|
|
255
|
+
onChange={(e) => setFormData({ ...formData, email: e.target.value })}
|
|
256
|
+
placeholder="you@example.com"
|
|
257
|
+
required
|
|
258
|
+
/>
|
|
259
|
+
<Input
|
|
260
|
+
label="Password"
|
|
261
|
+
type="password"
|
|
262
|
+
value={formData.password}
|
|
263
|
+
onChange={(e) => setFormData({ ...formData, password: e.target.value })}
|
|
264
|
+
helperText="Must be at least 8 characters"
|
|
265
|
+
required
|
|
266
|
+
/>
|
|
267
|
+
<Switch
|
|
268
|
+
label="Enable notifications"
|
|
269
|
+
checked={formData.notifications}
|
|
270
|
+
onCheckedChange={({ checked }) => setFormData({ ...formData, notifications: checked })}
|
|
271
|
+
/>
|
|
272
|
+
<div style={{ display: 'flex', gap: '0.5rem', marginTop: '0.5rem' }}>
|
|
273
|
+
<Button type="button" variant="text">
|
|
274
|
+
Forgot Password?
|
|
275
|
+
</Button>
|
|
276
|
+
<Button type="submit" variant="filled">
|
|
277
|
+
Log In
|
|
278
|
+
</Button>
|
|
279
|
+
</div>
|
|
280
|
+
{submitted && (
|
|
281
|
+
<p style={{ margin: 0, color: '#4C662B', fontSize: '0.875rem' }}>
|
|
282
|
+
✓ Form submitted successfully!
|
|
283
|
+
</p>
|
|
284
|
+
)}
|
|
285
|
+
</form>
|
|
286
|
+
</div>
|
|
287
|
+
</Card>
|
|
288
|
+
|
|
289
|
+
{/* Input Variants */}
|
|
290
|
+
<Card variant="elevated">
|
|
291
|
+
<div style={{ padding: '1.5rem' }}>
|
|
292
|
+
<h2 style={{ margin: '0 0 1rem 0' }}>Input Variants</h2>
|
|
293
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
|
|
294
|
+
<Input label="Outlined (default)" variant="outlined" placeholder="Enter text..." />
|
|
295
|
+
<Input label="Filled" variant="filled" placeholder="Enter text..." />
|
|
296
|
+
<Input label="With Error" errorText="This field is required" />
|
|
297
|
+
<Input label="Disabled" disabled value="Cannot edit" />
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
</Card>
|
|
301
|
+
|
|
302
|
+
{/* Switch Examples */}
|
|
303
|
+
<Card variant="elevated">
|
|
304
|
+
<div style={{ padding: '1.5rem' }}>
|
|
305
|
+
<h2 style={{ margin: '0 0 1rem 0' }}>Switch Examples</h2>
|
|
306
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '0.75rem' }}>
|
|
307
|
+
<Switch label="Email notifications" defaultChecked />
|
|
308
|
+
<Switch label="Dark mode" />
|
|
309
|
+
<Switch label="Auto-save" defaultChecked />
|
|
310
|
+
<Switch label="Disabled (on)" disabled defaultChecked />
|
|
311
|
+
<Switch label="Disabled (off)" disabled />
|
|
312
|
+
</div>
|
|
313
|
+
</div>
|
|
314
|
+
</Card>
|
|
315
|
+
</div>
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
## Step 5: Create LayoutExamples.tsx
|
|
321
|
+
|
|
322
|
+
### 5.1 Create File
|
|
323
|
+
|
|
324
|
+
1. Right-click **src/examples/**
|
|
325
|
+
2. **Create new file**
|
|
326
|
+
3. Name it: `LayoutExamples.tsx`
|
|
327
|
+
|
|
328
|
+
### 5.2 Add Content
|
|
329
|
+
|
|
330
|
+
```tsx
|
|
331
|
+
import { useState } from 'react';
|
|
332
|
+
import { Button, Card, Dialog } from '@discourser/design-system';
|
|
333
|
+
|
|
334
|
+
export function LayoutExamples() {
|
|
335
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
336
|
+
|
|
337
|
+
return (
|
|
338
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '1.5rem' }}>
|
|
339
|
+
{/* Card Variants */}
|
|
340
|
+
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))', gap: '1rem' }}>
|
|
341
|
+
<Card variant="elevated">
|
|
342
|
+
<div style={{ padding: '1.5rem' }}>
|
|
343
|
+
<h3 style={{ margin: '0 0 0.5rem 0' }}>Elevated Card</h3>
|
|
344
|
+
<p style={{ margin: 0, color: '#5E5F59', fontSize: '0.875rem' }}>
|
|
345
|
+
Default variant with shadow
|
|
346
|
+
</p>
|
|
347
|
+
</div>
|
|
348
|
+
</Card>
|
|
349
|
+
<Card variant="filled">
|
|
350
|
+
<div style={{ padding: '1.5rem' }}>
|
|
351
|
+
<h3 style={{ margin: '0 0 0.5rem 0' }}>Filled Card</h3>
|
|
352
|
+
<p style={{ margin: 0, color: '#5E5F59', fontSize: '0.875rem' }}>
|
|
353
|
+
Solid background variant
|
|
354
|
+
</p>
|
|
355
|
+
</div>
|
|
356
|
+
</Card>
|
|
357
|
+
<Card variant="outlined">
|
|
358
|
+
<div style={{ padding: '1.5rem' }}>
|
|
359
|
+
<h3 style={{ margin: '0 0 0.5rem 0' }}>Outlined Card</h3>
|
|
360
|
+
<p style={{ margin: 0, color: '#5E5F59', fontSize: '0.875rem' }}>
|
|
361
|
+
Border-only variant
|
|
362
|
+
</p>
|
|
363
|
+
</div>
|
|
364
|
+
</Card>
|
|
365
|
+
</div>
|
|
366
|
+
|
|
367
|
+
{/* Dialog Example */}
|
|
368
|
+
<Card variant="elevated">
|
|
369
|
+
<div style={{ padding: '1.5rem' }}>
|
|
370
|
+
<h2 style={{ margin: '0 0 1rem 0' }}>Dialog Example</h2>
|
|
371
|
+
<Button variant="filled" onClick={() => setDialogOpen(true)}>
|
|
372
|
+
Open Dialog
|
|
373
|
+
</Button>
|
|
374
|
+
|
|
375
|
+
<Dialog
|
|
376
|
+
open={dialogOpen}
|
|
377
|
+
onOpenChange={({ open }) => setDialogOpen(open)}
|
|
378
|
+
title="Example Dialog"
|
|
379
|
+
size="md"
|
|
380
|
+
>
|
|
381
|
+
<div style={{ padding: '1.5rem' }}>
|
|
382
|
+
<p style={{ marginTop: 0, color: '#5E5F59' }}>
|
|
383
|
+
This is an example dialog using the Dialog component from the design system.
|
|
384
|
+
</p>
|
|
385
|
+
<p style={{ marginBottom: 0, color: '#5E5F59' }}>
|
|
386
|
+
Click the X button or press Escape to close.
|
|
387
|
+
</p>
|
|
388
|
+
</div>
|
|
389
|
+
</Dialog>
|
|
390
|
+
</div>
|
|
391
|
+
</Card>
|
|
392
|
+
|
|
393
|
+
{/* Grid Layout */}
|
|
394
|
+
<Card variant="elevated">
|
|
395
|
+
<div style={{ padding: '1.5rem' }}>
|
|
396
|
+
<h2 style={{ margin: '0 0 1rem 0' }}>Responsive Grid Layout</h2>
|
|
397
|
+
<div
|
|
398
|
+
style={{
|
|
399
|
+
display: 'grid',
|
|
400
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(150px, 1fr))',
|
|
401
|
+
gap: '1rem',
|
|
402
|
+
}}
|
|
403
|
+
>
|
|
404
|
+
{[1, 2, 3, 4, 5, 6].map((num) => (
|
|
405
|
+
<div
|
|
406
|
+
key={num}
|
|
407
|
+
style={{
|
|
408
|
+
padding: '2rem 1rem',
|
|
409
|
+
background: '#EEEFE3',
|
|
410
|
+
borderRadius: '8px',
|
|
411
|
+
textAlign: 'center',
|
|
412
|
+
}}
|
|
413
|
+
>
|
|
414
|
+
Item {num}
|
|
415
|
+
</div>
|
|
416
|
+
))}
|
|
417
|
+
</div>
|
|
418
|
+
</div>
|
|
419
|
+
</Card>
|
|
420
|
+
</div>
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
## Step 6: Test All Examples
|
|
426
|
+
|
|
427
|
+
### 6.1 Preview the App
|
|
428
|
+
|
|
429
|
+
1. Click **Preview** button (top-right)
|
|
430
|
+
2. Wait for compilation
|
|
431
|
+
3. Verify all tabs work:
|
|
432
|
+
- Button Examples tab
|
|
433
|
+
- Form Examples tab
|
|
434
|
+
- Layout Examples tab
|
|
435
|
+
|
|
436
|
+
### 6.2 Test Interactivity
|
|
437
|
+
|
|
438
|
+
**Button Examples Tab:**
|
|
439
|
+
- ✅ All button variants display correctly
|
|
440
|
+
- ✅ All button sizes display correctly
|
|
441
|
+
- ✅ Disabled state shows properly
|
|
442
|
+
- ✅ Icon buttons render
|
|
443
|
+
|
|
444
|
+
**Form Examples Tab:**
|
|
445
|
+
- ✅ Login form accepts input
|
|
446
|
+
- ✅ Form submits and shows success message
|
|
447
|
+
- ✅ Input variants all display
|
|
448
|
+
- ✅ Switches toggle on/off
|
|
449
|
+
|
|
450
|
+
**Layout Examples Tab:**
|
|
451
|
+
- ✅ Card variants all render
|
|
452
|
+
- ✅ Dialog opens and closes
|
|
453
|
+
- ✅ Grid layout is responsive
|
|
454
|
+
|
|
455
|
+
### 6.3 Check Responsive Behavior
|
|
456
|
+
|
|
457
|
+
1. In preview, resize the browser window
|
|
458
|
+
2. Verify:
|
|
459
|
+
- ✅ Buttons wrap on small screens
|
|
460
|
+
- ✅ Grid adjusts column count
|
|
461
|
+
- ✅ Forms remain usable on mobile
|
|
462
|
+
|
|
463
|
+
## Step 7: Add README for Users
|
|
464
|
+
|
|
465
|
+
### 7.1 Create README.md
|
|
466
|
+
|
|
467
|
+
1. Right-click **src/**
|
|
468
|
+
2. **Create new file**
|
|
469
|
+
3. Name it: `README.md`
|
|
470
|
+
|
|
471
|
+
### 7.2 Add Content
|
|
472
|
+
|
|
473
|
+
```markdown
|
|
474
|
+
# Discourser Design System Template
|
|
475
|
+
|
|
476
|
+
This template provides a starting point for building applications with the Discourser Design System.
|
|
477
|
+
|
|
478
|
+
## What's Included
|
|
479
|
+
|
|
480
|
+
- ✅ `@discourser/design-system` pre-installed
|
|
481
|
+
- ✅ Complete design system guidelines in `guidelines/`
|
|
482
|
+
- ✅ Example components in `src/examples/`
|
|
483
|
+
- ✅ TypeScript + Vite configuration
|
|
484
|
+
- ✅ Material Design 3 components
|
|
485
|
+
|
|
486
|
+
## Getting Started
|
|
487
|
+
|
|
488
|
+
### 1. Explore the Examples
|
|
489
|
+
|
|
490
|
+
The app includes three tabs of examples:
|
|
491
|
+
- **Button Examples** - All button variants and sizes
|
|
492
|
+
- **Form Examples** - Form components and patterns
|
|
493
|
+
- **Layout Examples** - Card layouts and dialogs
|
|
494
|
+
|
|
495
|
+
### 2. Read the Guidelines
|
|
496
|
+
|
|
497
|
+
Access design system documentation in the `guidelines/` folder:
|
|
498
|
+
- Start with `Guidelines.md`
|
|
499
|
+
- Check `overview-components.md` for available components
|
|
500
|
+
- Read component-specific guides before using
|
|
501
|
+
|
|
502
|
+
### 3. Start Building
|
|
503
|
+
|
|
504
|
+
You can:
|
|
505
|
+
- Modify the existing examples
|
|
506
|
+
- Delete `src/examples/` and start fresh
|
|
507
|
+
- Keep examples as reference
|
|
508
|
+
|
|
509
|
+
## Using Figma Make AI
|
|
510
|
+
|
|
511
|
+
The AI is trained on the design system guidelines. Try asking:
|
|
512
|
+
- "Create a login form"
|
|
513
|
+
- "Add a card with a button"
|
|
514
|
+
- "Create a settings page with switches"
|
|
515
|
+
|
|
516
|
+
The AI will use the correct components and patterns automatically.
|
|
517
|
+
|
|
518
|
+
## Components Available
|
|
519
|
+
|
|
520
|
+
- **Button** - 5 variants, 3 sizes
|
|
521
|
+
- **Card** - 3 variants
|
|
522
|
+
- **Dialog** - Modal overlays
|
|
523
|
+
- **IconButton** - Icon-only buttons
|
|
524
|
+
- **Input** - Text input fields
|
|
525
|
+
- **Switch** - Toggle controls
|
|
526
|
+
|
|
527
|
+
## Design Tokens
|
|
528
|
+
|
|
529
|
+
Use semantic tokens instead of raw values:
|
|
530
|
+
- Colors: `primary`, `onPrimary`, `surface`, etc.
|
|
531
|
+
- Typography: `headlineLarge`, `bodyMedium`, etc.
|
|
532
|
+
- Spacing: `sm`, `md`, `lg`, etc.
|
|
533
|
+
|
|
534
|
+
## Learn More
|
|
535
|
+
|
|
536
|
+
- Package: https://www.npmjs.com/package/@discourser/design-system
|
|
537
|
+
- Guidelines: Check the `guidelines/` folder
|
|
538
|
+
- Material Design 3: https://m3.material.io/
|
|
539
|
+
|
|
540
|
+
## Need Help?
|
|
541
|
+
|
|
542
|
+
Ask Figma Make AI questions about:
|
|
543
|
+
- How to use components
|
|
544
|
+
- When to use which variant
|
|
545
|
+
- Best practices and patterns
|
|
546
|
+
|
|
547
|
+
The AI has access to all the design system guidelines!
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
## Tips for Effective Examples
|
|
551
|
+
|
|
552
|
+
### Keep It Simple
|
|
553
|
+
- ✅ Show common use cases
|
|
554
|
+
- ✅ Use clear labels and descriptions
|
|
555
|
+
- ❌ Don't add complex business logic
|
|
556
|
+
- ❌ Don't overcomplicate examples
|
|
557
|
+
|
|
558
|
+
### Make It Interactive
|
|
559
|
+
- ✅ Include working forms
|
|
560
|
+
- ✅ Add clickable buttons
|
|
561
|
+
- ✅ Show state changes
|
|
562
|
+
- ✅ Demonstrate dialogs/modals
|
|
563
|
+
|
|
564
|
+
### Provide Context
|
|
565
|
+
- ✅ Add comments explaining patterns
|
|
566
|
+
- ✅ Include helpful descriptions
|
|
567
|
+
- ✅ Show DO and DON'T examples
|
|
568
|
+
- ✅ Label each example clearly
|
|
569
|
+
|
|
570
|
+
## Checkpoint
|
|
571
|
+
|
|
572
|
+
Before moving to publication, verify:
|
|
573
|
+
|
|
574
|
+
- [x] App.tsx has tabbed examples
|
|
575
|
+
- [x] ButtonExamples.tsx created and working
|
|
576
|
+
- [x] FormExamples.tsx created and working
|
|
577
|
+
- [x] LayoutExamples.tsx created and working
|
|
578
|
+
- [x] All examples render in preview
|
|
579
|
+
- [x] Interactivity works (forms, dialogs, switches)
|
|
580
|
+
- [x] README.md created for users
|
|
581
|
+
|
|
582
|
+
**All complete?** ✅ Ready to publish!
|
|
583
|
+
|
|
584
|
+
## What's Next?
|
|
585
|
+
|
|
586
|
+
With examples in place, your template is feature-complete. Now it's time to publish it so your team can use it!
|
|
587
|
+
|
|
588
|
+
**Next:** [Publishing Your Template](./06-publishing-template.md) →
|
|
589
|
+
|
|
590
|
+
**Previous:** [Adding Guidelines](./04-adding-guidelines.md) ←
|