diff options
author | 2021-07-30 10:54:54 +0200 | |
---|---|---|
committer | 2021-07-30 14:24:54 +0530 | |
commit | f4b4416ea52d564bc2dbe543a82084ed98843ccc (patch) | |
tree | 7ca6b23571c86458a6b799746c91a7191de02715 /uidev/src/stories/button.stories.tsx | |
parent | 5.6.1-nightly.8 [skip ci] (diff) | |
download | ferdium-app-f4b4416ea52d564bc2dbe543a82084ed98843ccc.tar.gz ferdium-app-f4b4416ea52d564bc2dbe543a82084ed98843ccc.tar.zst ferdium-app-f4b4416ea52d564bc2dbe543a82084ed98843ccc.zip |
chore: migrate from tslint to @typescript-eslint (#1706)
- update .eslintrc to work for .js and .ts
- update devDependencies
- lint properly both root /src and nested /packages
- update webhint recommended setting for tsconfig.json to shrink output
- Manage all eslint rules from the repo root
- escape single quotes in scripts to please windows build
Co-authored-by: Vijay A <avijayr@protonmail.com>
Diffstat (limited to 'uidev/src/stories/button.stories.tsx')
-rw-r--r-- | uidev/src/stories/button.stories.tsx | 72 |
1 files changed, 41 insertions, 31 deletions
diff --git a/uidev/src/stories/button.stories.tsx b/uidev/src/stories/button.stories.tsx index 5c1c9246d..5ca657238 100644 --- a/uidev/src/stories/button.stories.tsx +++ b/uidev/src/stories/button.stories.tsx | |||
@@ -27,20 +27,18 @@ const styles = { | |||
27 | }, | 27 | }, |
28 | }; | 28 | }; |
29 | 29 | ||
30 | const createStore = (args?: any) => { | 30 | const createStore = (args?: any) => observable({ ...defaultProps, ...args }); |
31 | return observable(Object.assign({}, defaultProps, args)); | ||
32 | }; | ||
33 | 31 | ||
34 | const WithStoreButton = observer(({ store }: { store: any }) => ( | 32 | const WithStoreButton = observer(({ store }: { store: any }) => ( |
35 | <> | 33 | <> |
36 | <Button | 34 | <Button |
37 | {...Object.assign({}, defaultProps, store)} | 35 | {...({ ...defaultProps, ...store })} |
38 | onClick={!store.onClick ? () => { | 36 | onClick={!store.onClick ? () => { |
39 | store.busy = !store.busy; | 37 | store.busy = !store.busy; |
40 | 38 | ||
41 | window.setTimeout(() => { | 39 | window.setTimeout(() => { |
42 | store.busy = !store.busy; | 40 | store.busy = !store.busy; |
43 | }, 1000); | 41 | }, 1000); |
44 | } : store.onClick} | 42 | } : store.onClick} |
45 | /> | 43 | /> |
46 | </> | 44 | </> |
@@ -53,58 +51,69 @@ storiesOf('Button') | |||
53 | .add('Secondary', () => ( | 51 | .add('Secondary', () => ( |
54 | <WithStoreButton store={createStore({ | 52 | <WithStoreButton store={createStore({ |
55 | buttonType: 'secondary', | 53 | buttonType: 'secondary', |
56 | })} /> | 54 | })} |
55 | /> | ||
57 | )) | 56 | )) |
58 | .add('Success', () => ( | 57 | .add('Success', () => ( |
59 | <WithStoreButton store={createStore({ | 58 | <WithStoreButton store={createStore({ |
60 | buttonType: 'success', | 59 | buttonType: 'success', |
61 | })} /> | 60 | })} |
61 | /> | ||
62 | )) | 62 | )) |
63 | .add('Warning', () => ( | 63 | .add('Warning', () => ( |
64 | <WithStoreButton store={createStore({ | 64 | <WithStoreButton store={createStore({ |
65 | buttonType: 'warning', | 65 | buttonType: 'warning', |
66 | })} /> | 66 | })} |
67 | /> | ||
67 | )) | 68 | )) |
68 | .add('Danger', () => ( | 69 | .add('Danger', () => ( |
69 | <WithStoreButton store={createStore({ | 70 | <WithStoreButton store={createStore({ |
70 | buttonType: 'danger', | 71 | buttonType: 'danger', |
71 | })} /> | 72 | })} |
73 | /> | ||
72 | )) | 74 | )) |
73 | .add('Inverted', () => ( | 75 | .add('Inverted', () => ( |
74 | <WithStoreButton store={createStore({ | 76 | <WithStoreButton store={createStore({ |
75 | buttonType: 'inverted', | 77 | buttonType: 'inverted', |
76 | })} /> | 78 | })} |
79 | /> | ||
77 | )) | 80 | )) |
78 | .add('Full width', () => ( | 81 | .add('Full width', () => ( |
79 | <WithStoreButton store={createStore({ | 82 | <WithStoreButton store={createStore({ |
80 | stretch: true, | 83 | stretch: true, |
81 | })} /> | 84 | })} |
85 | /> | ||
82 | )) | 86 | )) |
83 | .add('Disabled', () => ( | 87 | .add('Disabled', () => ( |
84 | <WithStoreButton store={createStore({ | 88 | <WithStoreButton store={createStore({ |
85 | disabled: true, | 89 | disabled: true, |
86 | })} /> | 90 | })} |
91 | /> | ||
87 | )) | 92 | )) |
88 | .add('With loader', () => ( | 93 | .add('With loader', () => ( |
89 | <WithStoreButton store={createStore({ | 94 | <WithStoreButton store={createStore({ |
90 | busy: true, | 95 | busy: true, |
91 | })} /> | 96 | })} |
97 | /> | ||
92 | )) | 98 | )) |
93 | .add('With icon', () => ( | 99 | .add('With icon', () => ( |
94 | <WithStoreButton store={createStore({ | 100 | <WithStoreButton store={createStore({ |
95 | icon: mdiInformation, | 101 | icon: mdiInformation, |
96 | })} /> | 102 | })} |
103 | /> | ||
97 | )) | 104 | )) |
98 | .add('As link', () => ( | 105 | .add('As link', () => ( |
99 | <WithStoreButton store={createStore({ | 106 | <WithStoreButton store={createStore({ |
100 | href: 'https://meetfranz.com', | 107 | href: 'https://meetfranz.com', |
101 | })} /> | 108 | })} |
109 | /> | ||
102 | )) | 110 | )) |
103 | .add('As link (target=_blank)', () => ( | 111 | .add('As link (target=_blank)', () => ( |
104 | <WithStoreButton store={createStore({ | 112 | <WithStoreButton store={createStore({ |
105 | href: 'https://meetfranz.com', | 113 | href: 'https://meetfranz.com', |
106 | target: '_blank', | 114 | target: '_blank', |
107 | })} /> | 115 | })} |
116 | /> | ||
108 | )) | 117 | )) |
109 | .add('As link (with onClick)', () => ( | 118 | .add('As link (with onClick)', () => ( |
110 | <WithStoreButton store={createStore({ | 119 | <WithStoreButton store={createStore({ |
@@ -113,26 +122,27 @@ storiesOf('Button') | |||
113 | e.preventDefault(); | 122 | e.preventDefault(); |
114 | alert('Click event'); | 123 | alert('Click event'); |
115 | }, | 124 | }, |
116 | })}/> | 125 | })} |
126 | /> | ||
117 | )) | 127 | )) |
118 | .add('Long multi-line button', () => ( | 128 | .add('Long multi-line button', () => ( |
119 | <WithStoreButton store={createStore({ | 129 | <WithStoreButton store={createStore({ |
120 | 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.', | 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.', |
121 | })} /> | 131 | })} |
132 | /> | ||
122 | )) | 133 | )) |
123 | .add('Button with Input', injectSheet(styles)(observer(({ classes }: { classes: Classes }) => ( | 134 | .add('Button with Input', injectSheet(styles)(observer(({ classes }: { classes: Classes }) => ( |
124 | <div className={classes.combinedElements}> | 135 | <div className={classes.combinedElements}> |
125 | <Input showLabel={false} className={classes.input} noMargin /> | 136 | <Input showLabel={false} className={classes.input} noMargin /> |
126 | <WithStoreButton store={createStore({})} /> | 137 | <WithStoreButton store={createStore({})} /> |
127 | </div> | 138 | </div> |
128 | )), | 139 | )))) |
129 | )) | ||
130 | .add('Icon Button with Input', injectSheet(styles)(observer(({ classes }: { classes: Classes }) => ( | 140 | .add('Icon Button with Input', injectSheet(styles)(observer(({ classes }: { classes: Classes }) => ( |
131 | <div className={classes.combinedElements}> | 141 | <div className={classes.combinedElements}> |
132 | <Input showLabel={false} className={classes.input} noMargin /> | 142 | <Input showLabel={false} className={classes.input} noMargin /> |
133 | <WithStoreButton store={createStore({ | 143 | <WithStoreButton store={createStore({ |
134 | icon: mdiInformation, | 144 | icon: mdiInformation, |
135 | })} /> | 145 | })} |
136 | </div> | 146 | /> |
137 | )), | 147 | </div> |
138 | )); | 148 | )))); |