-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathdemo.ts
More file actions
160 lines (150 loc) · 3.85 KB
/
demo.ts
File metadata and controls
160 lines (150 loc) · 3.85 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
'use client';
import { getPropsString } from '@/lib/utils';
export const getCode = (props: any) => {
return `<Progress${getPropsString(props)} />`;
};
export const playground = {
type: 'playground',
controls: {
value: { type: 'number', initialValue: 40, min: 0, max: 100 },
variant: {
type: 'select',
initialValue: 'linear',
options: ['linear', 'circular']
},
min: { type: 'number', defaultValue: 0, min: 0, max: 99 },
max: { type: 'number', defaultValue: 100, min: 1, max: 100 }
},
getCode
};
export const directUsageDemo = {
type: 'code',
code: `<Flex direction="column" gap="large" style={{ width: "300px" }}>
<Progress value={40} />
<Progress value={70} />
<Progress value={100} />
</Flex>`
};
export const variantDemo = {
type: 'code',
tabs: [
{
name: 'Linear',
code: `<Flex direction="column" gap="large" style={{ width: "300px" }}>
<Progress value={15}>
<Flex justify="between">
<Progress.Label>Uploading...</Progress.Label>
<Progress.Value />
</Flex>
<Progress.Track />
</Progress>
</Flex>`
},
{
name: 'Circular',
code: `<Flex gap="large" align="center">
<Progress variant="circular" value={70}>
<Progress.Track />
<Progress.Value />
</Progress>
<Progress variant="circular" value={30}>
<Progress.Track />
<Progress.Value />
</Progress>
<Progress variant="circular" value={90}>
<Progress.Track />
<Progress.Value />
</Progress>
</Flex>`
}
]
};
export const customizationDemo = {
type: 'code',
tabs: [
{
name: 'Linear',
code: `<Flex direction="column" gap="large" style={{ width: "300px" }}>
<Progress value={60}>
<Progress.Track style={{ height: 2 }} />
</Progress>
<Progress value={60}>
<Progress.Track />
</Progress>
<Progress value={60}>
<Progress.Track style={{ height: 8 }} />
</Progress>
</Flex>`
},
{
name: 'Circular',
code: `<Flex gap="large" align="center">
<Progress variant="circular" value={60}>
<Progress.Track style={{ width: 48, height: 48 }} />
<Progress.Value />
</Progress>
<Progress variant="circular" value={60}>
<Progress.Track />
<Progress.Value />
</Progress>
<Progress variant="circular" value={60}>
<Progress.Track style={{ width: 96, height: 96, "--rs-progress-track-size": "2px" }} />
<Progress.Value />
</Progress>
<Progress variant="circular" value={60}>
<Progress.Track style={{ "--rs-progress-track-size": "8px" }} />
<Progress.Value />
</Progress>
</Flex>`
}
]
};
export const animatedDemo = {
type: 'code',
code: `function AnimatedProgress() {
const [value, setValue] = React.useState(0);
React.useEffect(() => {
const interval = setInterval(() => {
setValue((current) => {
if (current >= 100) return 0;
return Math.min(100, Math.round(current + Math.random() * 25));
});
}, 1000);
return () => clearInterval(interval);
}, []);
return (
<Flex gap="large" align="center">
<Progress value={value} style={{ width: 300 }}>
<Flex justify="between">
<Progress.Label>Uploading...</Progress.Label>
<Progress.Value />
</Flex>
<Progress.Track />
</Progress>
<Progress variant="circular" value={value}>
<Progress.Track />
<Progress.Value />
</Progress>
</Flex>
);
}`
};
export const withLabelsDemo = {
type: 'code',
code: `<Flex direction="column" gap="large" style={{ width: "300px" }}>
<Progress value={60}>
<Flex justify="between">
<Progress.Label>Uploading files...</Progress.Label>
<Progress.Value />
</Flex>
<Progress.Track />
</Progress>
<Progress value={85}>
<Flex justify="between">
<Progress.Label>Processing...</Progress.Label>
<Progress.Value />
</Flex>
<Progress.Track />
</Progress>
</Flex>`
};