-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathpreview-panel.tsx
More file actions
272 lines (255 loc) · 8.94 KB
/
preview-panel.tsx
File metadata and controls
272 lines (255 loc) · 8.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
import React from 'react';
import {
Alert,
Avatar,
Badge,
Breadcrumb,
Button,
Card,
Checkbox,
Collapse,
Divider,
Dropdown,
Flex,
Input,
InputNumber,
Link,
Menu,
Pagination,
Popover,
Progress,
Radio,
Rate,
Segmented,
Select,
Skeleton,
Slider,
Space,
Statistic,
Steps,
Switch,
Table,
Tabs,
Tag,
Textarea,
Timeline,
Tooltip,
Typography,
} from '@tiny-design/react';
const tableColumns = [
{ title: 'Name', dataIndex: 'name', key: 'name' },
{ title: 'Age', dataIndex: 'age', key: 'age' },
{ title: 'Role', dataIndex: 'role', key: 'role' },
];
const tableData = [
{ key: '1', name: 'Alice', age: 28, role: 'Designer' },
{ key: '2', name: 'Bob', age: 32, role: 'Developer' },
{ key: '3', name: 'Carol', age: 25, role: 'Manager' },
];
const dropdownMenu = (
<Menu>
<Menu.Item index="1">Action 1</Menu.Item>
<Menu.Item index="2">Action 2</Menu.Item>
<Menu.Item index="3">Action 3</Menu.Item>
</Menu>
);
export const PreviewPanel = (): React.ReactElement => {
return (
<div className="theme-editor__preview">
<h3 className="theme-editor__preview-title">Live Preview</h3>
{/* Buttons */}
<section className="theme-editor__preview-section">
<h4>Buttons</h4>
<Flex gap="sm" wrap="wrap">
<Button btnType="primary">Primary</Button>
<Button>Default</Button>
<Button btnType="outline">Outline</Button>
<Button btnType="ghost">Ghost</Button>
<Button btnType="link">Link</Button>
<Button btnType="danger">Danger</Button>
<Button btnType="primary" loading>
Loading
</Button>
<Button disabled>Disabled</Button>
</Flex>
<Flex gap="sm" align="center" style={{ marginTop: 8 }}>
<Button size="sm" btnType="primary">Small</Button>
<Button size="md" btnType="primary">Medium</Button>
<Button size="lg" btnType="primary">Large</Button>
<Dropdown overlay={dropdownMenu}>
<Button btnType="outline">Dropdown</Button>
</Dropdown>
</Flex>
</section>
<Divider />
{/* Form Controls */}
<section className="theme-editor__preview-section">
<h4>Form Controls</h4>
<Flex gap="sm" wrap="wrap">
<Input placeholder="Input text..." style={{ width: 200 }} />
<InputNumber defaultValue={42} style={{ width: 120 }} />
<Select defaultValue="option1" style={{ width: 160 }}>
<Select.Option value="option1">Option 1</Select.Option>
<Select.Option value="option2">Option 2</Select.Option>
<Select.Option value="option3">Option 3</Select.Option>
</Select>
</Flex>
<Flex gap="sm" align="center" style={{ marginTop: 12 }}>
<Checkbox defaultChecked>Checkbox</Checkbox>
<Radio.Group defaultValue="a">
<Radio value="a">Radio A</Radio>
<Radio value="b">Radio B</Radio>
</Radio.Group>
<Switch defaultChecked />
<Rate defaultValue={3} />
</Flex>
<Slider defaultValue={40} style={{ marginTop: 12 }} />
<Textarea rows={2} defaultValue="" style={{ marginTop: 12 }} />
</section>
<Divider />
{/* Data Display */}
<section className="theme-editor__preview-section">
<h4>Data Display</h4>
<Flex gap="md" wrap="wrap" style={{ marginBottom: 16 }}>
<Statistic title="Users" value={1128} />
<Statistic title="Revenue" value={9280} prefix="$" />
<Statistic title="Growth" value={12.5} suffix="%" precision={1} />
</Flex>
<Table columns={tableColumns} dataSource={tableData} pagination={false} bordered />
<Card title="Card Title" style={{ marginTop: 16 }}>
<Card.Content>
<p>Card content with some text to show how typography looks in a card component.</p>
<p>Card content with some text to show how typography looks in a card component.</p>
</Card.Content>
</Card>
<Flex gap="sm" wrap="wrap" style={{ marginTop: 16 }}>
<Tag>Default</Tag>
<Tag color="success">Success</Tag>
<Tag color="warning">Warning</Tag>
<Tag color="danger">Danger</Tag>
<Tag color="blue">Blue</Tag>
<Tag color="green">Green</Tag>
<Tag color="orange">Orange</Tag>
</Flex>
<Flex gap="sm" align="center" style={{ marginTop: 12 }}>
<Badge count={5}>
<div
style={{
width: 42,
height: 42,
borderRadius: 'var(--ty-border-radius)',
background: 'var(--ty-color-bg-spotlight)',
}}
/>
</Badge>
<Badge dot>
<div
style={{
width: 42,
height: 42,
borderRadius: 'var(--ty-border-radius)',
background: 'var(--ty-color-bg-spotlight)',
}}
/>
</Badge>
<Avatar size={42}>A</Avatar>
<Avatar size={42} shape="square">B</Avatar>
<Avatar size={42} presence="online">C</Avatar>
</Flex>
<Flex gap="lg" style={{ marginTop: 16 }}>
<Progress.Circle percent={75} width={80} />
<Progress.Circle percent={50} width={80} strokeColor="green" />
<Progress.Circle percent={90} width={80} strokeColor="yellow" />
</Flex>
<Progress.Bar percent={65} style={{ marginTop: 12 }} />
</section>
<Divider />
{/* Typography & Overlay */}
<section className="theme-editor__preview-section">
<h4>Typography & Overlay</h4>
<Typography>
<Typography.Heading level={4}>Heading</Typography.Heading>
<Typography.Paragraph>
This is a paragraph with <Typography.Text strong>bold</Typography.Text>,{' '}
<Typography.Text italic>italic</Typography.Text>,{' '}
<Typography.Text code>code</Typography.Text>, and{' '}
<Typography.Text mark>marked</Typography.Text> text.{' '}
<Link href="#">Learn more</Link>
</Typography.Paragraph>
</Typography>
<Flex gap="sm" style={{ marginTop: 12 }}>
<Tooltip title="Tooltip text">
<Button>Tooltip</Button>
</Tooltip>
<Popover title="Popover Title" content="Popover content goes here.">
<Button>Popover</Button>
</Popover>
</Flex>
</section>
<Divider />
{/* Feedback */}
<section className="theme-editor__preview-section">
<h4>Feedback</h4>
<Space direction="vertical" style={{ width: '100%' }}>
<Alert type="success" title="Success alert message" />
<Alert type="info" title="Info alert message" />
<Alert type="warning" title="Warning alert message" />
<Alert type="error" title="Error alert message" />
</Space>
<Skeleton active style={{ marginTop: 16 }} />
</section>
<Divider />
{/* Navigation */}
<section className="theme-editor__preview-section">
<h4>Navigation</h4>
<Breadcrumb>
<Breadcrumb.Item>Home</Breadcrumb.Item>
<Breadcrumb.Item>Theme</Breadcrumb.Item>
<Breadcrumb.Item>Editor</Breadcrumb.Item>
</Breadcrumb>
<Segmented
options={['Daily', 'Weekly', 'Monthly', 'Yearly']}
style={{ marginTop: 12 }}
/>
<Tabs defaultActiveKey="1" style={{ marginTop: 12 }}>
<Tabs.Panel tab="Tab 1" tabKey="1">
Tab content 1
</Tabs.Panel>
<Tabs.Panel tab="Tab 2" tabKey="2">
Tab content 2
</Tabs.Panel>
<Tabs.Panel tab="Tab 3" tabKey="3">
Tab content 3
</Tabs.Panel>
</Tabs>
<Steps current={1} style={{ marginTop: 16 }}>
<Steps.Step title="Finished" />
<Steps.Step title="In Progress" />
<Steps.Step title="Waiting" />
</Steps>
<Pagination total={100} defaultCurrent={1} style={{ marginTop: 16 }} />
</section>
<Divider />
{/* Expandable */}
<section className="theme-editor__preview-section">
<h4>Expandable & Timeline</h4>
<Collapse defaultActiveKey={['1']}>
<Collapse.Panel itemKey="1" header="Panel 1">
Content for the first collapsible panel.
</Collapse.Panel>
<Collapse.Panel itemKey="2" header="Panel 2">
Content for the second collapsible panel.
</Collapse.Panel>
<Collapse.Panel itemKey="3" header="Panel 3" disabled>
This panel is disabled.
</Collapse.Panel>
</Collapse>
<Timeline style={{ marginTop: 16 }}>
<Timeline.Item>Design review completed</Timeline.Item>
<Timeline.Item>Development in progress</Timeline.Item>
<Timeline.Item>Testing pending</Timeline.Item>
</Timeline>
</section>
</div>
);
};