diff options
author | 2021-10-15 09:48:06 +0200 | |
---|---|---|
committer | 2021-10-15 09:48:06 +0200 | |
commit | 14d2364fc69e0222133115c55a36286986006098 (patch) | |
tree | 9e9b3c41ef742bbe87ca1632b292c67043051957 /uidev/src/stories/button.stories.tsx | |
parent | 5.6.3-nightly.34 [skip ci] (diff) | |
download | ferdium-app-14d2364fc69e0222133115c55a36286986006098.tar.gz ferdium-app-14d2364fc69e0222133115c55a36286986006098.tar.zst ferdium-app-14d2364fc69e0222133115c55a36286986006098.zip |
chore: update eslint setup (#2074)
Diffstat (limited to 'uidev/src/stories/button.stories.tsx')
-rw-r--r-- | uidev/src/stories/button.stories.tsx | 165 |
1 files changed, 96 insertions, 69 deletions
diff --git a/uidev/src/stories/button.stories.tsx b/uidev/src/stories/button.stories.tsx index e948e8ca4..400063cea 100644 --- a/uidev/src/stories/button.stories.tsx +++ b/uidev/src/stories/button.stories.tsx | |||
@@ -32,117 +32,144 @@ const createStore = (args?: any) => observable({ ...defaultProps, ...args }); | |||
32 | const WithStoreButton = observer(({ store }: { store: any }) => ( | 32 | const WithStoreButton = observer(({ store }: { store: any }) => ( |
33 | <> | 33 | <> |
34 | <Button | 34 | <Button |
35 | {...({ ...defaultProps, ...store })} | 35 | {...{ ...defaultProps, ...store }} |
36 | onClick={!store.onClick ? () => { | 36 | onClick={ |
37 | store.busy = !store.busy; | 37 | !store.onClick |
38 | ? () => { | ||
39 | store.busy = !store.busy; | ||
38 | 40 | ||
39 | window.setTimeout(() => { | 41 | window.setTimeout(() => { |
40 | store.busy = !store.busy; | 42 | store.busy = !store.busy; |
41 | }, 1000); | 43 | }, 1000); |
42 | } : store.onClick} | 44 | } |
45 | : store.onClick | ||
46 | } | ||
43 | /> | 47 | /> |
44 | </> | 48 | </> |
45 | )); | 49 | )); |
46 | 50 | ||
47 | storiesOf('Button') | 51 | storiesOf('Button') |
48 | .add('Basic', () => ( | 52 | .add('Basic', () => <WithStoreButton store={createStore()} />) |
49 | <WithStoreButton store={createStore()} /> | ||
50 | )) | ||
51 | .add('Secondary', () => ( | 53 | .add('Secondary', () => ( |
52 | <WithStoreButton store={createStore({ | 54 | <WithStoreButton |
53 | buttonType: 'secondary', | 55 | store={createStore({ |
54 | })} | 56 | buttonType: 'secondary', |
57 | })} | ||
55 | /> | 58 | /> |
56 | )) | 59 | )) |
57 | .add('Success', () => ( | 60 | .add('Success', () => ( |
58 | <WithStoreButton store={createStore({ | 61 | <WithStoreButton |
59 | buttonType: 'success', | 62 | store={createStore({ |
60 | })} | 63 | buttonType: 'success', |
64 | })} | ||
61 | /> | 65 | /> |
62 | )) | 66 | )) |
63 | .add('Warning', () => ( | 67 | .add('Warning', () => ( |
64 | <WithStoreButton store={createStore({ | 68 | <WithStoreButton |
65 | buttonType: 'warning', | 69 | store={createStore({ |
66 | })} | 70 | buttonType: 'warning', |
71 | })} | ||
67 | /> | 72 | /> |
68 | )) | 73 | )) |
69 | .add('Danger', () => ( | 74 | .add('Danger', () => ( |
70 | <WithStoreButton store={createStore({ | 75 | <WithStoreButton |
71 | buttonType: 'danger', | 76 | store={createStore({ |
72 | })} | 77 | buttonType: 'danger', |
78 | })} | ||
73 | /> | 79 | /> |
74 | )) | 80 | )) |
75 | .add('Inverted', () => ( | 81 | .add('Inverted', () => ( |
76 | <WithStoreButton store={createStore({ | 82 | <WithStoreButton |
77 | buttonType: 'inverted', | 83 | store={createStore({ |
78 | })} | 84 | buttonType: 'inverted', |
85 | })} | ||
79 | /> | 86 | /> |
80 | )) | 87 | )) |
81 | .add('Full width', () => ( | 88 | .add('Full width', () => ( |
82 | <WithStoreButton store={createStore({ | 89 | <WithStoreButton |
83 | stretch: true, | 90 | store={createStore({ |
84 | })} | 91 | stretch: true, |
92 | })} | ||
85 | /> | 93 | /> |
86 | )) | 94 | )) |
87 | .add('Disabled', () => ( | 95 | .add('Disabled', () => ( |
88 | <WithStoreButton store={createStore({ | 96 | <WithStoreButton |
89 | disabled: true, | 97 | store={createStore({ |
90 | })} | 98 | disabled: true, |
99 | })} | ||
91 | /> | 100 | /> |
92 | )) | 101 | )) |
93 | .add('With loader', () => ( | 102 | .add('With loader', () => ( |
94 | <WithStoreButton store={createStore({ | 103 | <WithStoreButton |
95 | busy: true, | 104 | store={createStore({ |
96 | })} | 105 | busy: true, |
106 | })} | ||
97 | /> | 107 | /> |
98 | )) | 108 | )) |
99 | .add('With icon', () => ( | 109 | .add('With icon', () => ( |
100 | <WithStoreButton store={createStore({ | 110 | <WithStoreButton |
101 | icon: mdiInformation, | 111 | store={createStore({ |
102 | })} | 112 | icon: mdiInformation, |
113 | })} | ||
103 | /> | 114 | /> |
104 | )) | 115 | )) |
105 | .add('As link', () => ( | 116 | .add('As link', () => ( |
106 | <WithStoreButton store={createStore({ | 117 | <WithStoreButton |
107 | href: 'https://meetfranz.com', | 118 | store={createStore({ |
108 | })} | 119 | href: 'https://meetfranz.com', |
120 | })} | ||
109 | /> | 121 | /> |
110 | )) | 122 | )) |
111 | .add('As link (target=_blank)', () => ( | 123 | .add('As link (target=_blank)', () => ( |
112 | <WithStoreButton store={createStore({ | 124 | <WithStoreButton |
113 | href: 'https://meetfranz.com', | 125 | store={createStore({ |
114 | target: '_blank', | 126 | href: 'https://meetfranz.com', |
115 | })} | 127 | target: '_blank', |
128 | })} | ||
116 | /> | 129 | /> |
117 | )) | 130 | )) |
118 | .add('As link (with onClick)', () => ( | 131 | .add('As link (with onClick)', () => ( |
119 | <WithStoreButton store={createStore({ | 132 | <WithStoreButton |
120 | href: 'https://meetfranz.com', | 133 | store={createStore({ |
121 | onClick: (e: React.MouseEvent<HTMLAnchorElement>) => { | 134 | href: 'https://meetfranz.com', |
122 | e.preventDefault(); | 135 | onClick: (e: React.MouseEvent<HTMLAnchorElement>) => { |
123 | alert('Click event'); | 136 | e.preventDefault(); |
124 | }, | 137 | alert('Click event'); |
125 | })} | 138 | }, |
139 | })} | ||
126 | /> | 140 | /> |
127 | )) | 141 | )) |
128 | .add('Long multi-line button', () => ( | 142 | .add('Long multi-line button', () => ( |
129 | <WithStoreButton store={createStore({ | 143 | <WithStoreButton |
130 | label: 'But there is something that I must say to my people, who stand on the warm threshold which leads into the palace of justice: In the process of gaining our rightful place, we must not be guilty of wrongful deeds. Let us not seek to satisfy our thirst for freedom by drinking from the cup of bitterness and hatred. We must forever conduct our struggle on the high plane of dignity and discipline. We must not allow our creative protest to degenerate into physical violence. Again and again, we must rise to the majestic heights of meeting physical force with soul force.', | 144 | store={createStore({ |
131 | })} | 145 | label: |
146 | 'But there is something that I must say to my people, who stand on the warm threshold which leads into the palace of justice: In the process of gaining our rightful place, we must not be guilty of wrongful deeds. Let us not seek to satisfy our thirst for freedom by drinking from the cup of bitterness and hatred. We must forever conduct our struggle on the high plane of dignity and discipline. We must not allow our creative protest to degenerate into physical violence. Again and again, we must rise to the majestic heights of meeting physical force with soul force.', | ||
147 | })} | ||
132 | /> | 148 | /> |
133 | )) | 149 | )) |
134 | .add('Button with Input', injectSheet(styles)(observer(({ classes }: { classes: Classes }) => ( | 150 | .add( |
135 | <div className={classes.combinedElements}> | 151 | 'Button with Input', |
136 | <Input showLabel={false} className={classes.input} noMargin /> | 152 | injectSheet(styles)( |
137 | <WithStoreButton store={createStore({})} /> | 153 | observer(({ classes }: { classes: Classes }) => ( |
138 | </div> | 154 | <div className={classes.combinedElements}> |
139 | )))) | 155 | <Input showLabel={false} className={classes.input} noMargin /> |
140 | .add('Icon Button with Input', injectSheet(styles)(observer(({ classes }: { classes: Classes }) => ( | 156 | <WithStoreButton store={createStore({})} /> |
141 | <div className={classes.combinedElements}> | 157 | </div> |
142 | <Input showLabel={false} className={classes.input} noMargin /> | 158 | )), |
143 | <WithStoreButton store={createStore({ | 159 | ), |
144 | icon: mdiInformation, | 160 | ) |
145 | })} | 161 | .add( |
146 | /> | 162 | 'Icon Button with Input', |
147 | </div> | 163 | injectSheet(styles)( |
148 | )))); | 164 | observer(({ classes }: { classes: Classes }) => ( |
165 | <div className={classes.combinedElements}> | ||
166 | <Input showLabel={false} className={classes.input} noMargin /> | ||
167 | <WithStoreButton | ||
168 | store={createStore({ | ||
169 | icon: mdiInformation, | ||
170 | })} | ||
171 | /> | ||
172 | </div> | ||
173 | )), | ||
174 | ), | ||
175 | ); | ||