-
-
Notifications
You must be signed in to change notification settings - Fork 169
/
Copy pathControlExample.stories.tsx
91 lines (85 loc) · 1.78 KB
/
ControlExample.stories.tsx
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
import { Meta, StoryObj } from '@storybook/react';
import { ControlExample } from './ControlExample';
const meta = {
title: 'ControlExamples/Control Example',
component: ControlExample,
args: {
name: 'Storyteller',
age: 70,
fruit: 'apple',
otherFruit: 'watermelon',
dollars: 12.5,
backgroundColor: '#eaeaea',
items: ['Laptop', 'Book', 'Whiskey'],
customStyles: {
borderWidth: 3,
borderColor: '#000',
padding: 10,
},
nice: true,
birthday: new Date(2017, 0, 20),
test1: true,
test2: false,
test3: true,
test4: false,
test5: true,
test6: false,
test7: true,
test8: true,
test9: true,
test10: true,
},
argTypes: {
age: {
step: 5,
min: 0,
max: 90,
range: true,
},
fruit: {
options: ['apple', 'banana', 'cherry'],
control: {
type: 'select',
labels: {
apple: 'Apple',
banana: 'Banana',
cherry: 'Cherry',
},
},
},
otherFruit: {
options: ['kiwi', 'guava', 'watermelon'],
control: {
type: 'radio',
labels: {
kiwi: 'Kiwi',
guava: 'Guava',
watermelon: 'Watermelon',
},
},
},
dollars: {
min: 0,
max: 100,
},
birthday: {
control: { type: 'date' },
},
backgroundColor: {
control: { type: 'color' },
},
items: {
// @ts-ignore
control: { type: 'array' },
},
customStyles: {
control: { type: 'object' },
},
invalid: {
control: { type: 'nonexistent_type' },
},
},
} satisfies Meta<typeof ControlExample>;
export default meta;
type ControlExampleStory = StoryObj<typeof ControlExample>;
export const Example: ControlExampleStory = {};