diff options
author | 2021-10-15 14:02:33 +0530 | |
---|---|---|
committer | 2021-10-15 14:02:33 +0530 | |
commit | 184c8fbaa6ea3fb13af93ec023252af8802040a3 (patch) | |
tree | ba3671d972d74f524a07609a49b80a885ebe2115 /uidev/src/stories/button.stories.tsx | |
parent | update recipes to pull in pnpm upgrade and workspace fix. (diff) | |
download | ferdium-app-184c8fbaa6ea3fb13af93ec023252af8802040a3.tar.gz ferdium-app-184c8fbaa6ea3fb13af93ec023252af8802040a3.tar.zst ferdium-app-184c8fbaa6ea3fb13af93ec023252af8802040a3.zip |
Remove unused 'uidev' folder. (#2076)
Diffstat (limited to 'uidev/src/stories/button.stories.tsx')
-rw-r--r-- | uidev/src/stories/button.stories.tsx | 175 |
1 files changed, 0 insertions, 175 deletions
diff --git a/uidev/src/stories/button.stories.tsx b/uidev/src/stories/button.stories.tsx deleted file mode 100644 index 400063cea..000000000 --- a/uidev/src/stories/button.stories.tsx +++ /dev/null | |||
@@ -1,175 +0,0 @@ | |||
1 | import { mdiInformation } from '@mdi/js'; | ||
2 | import { observable } from 'mobx'; | ||
3 | import { observer } from 'mobx-react'; | ||
4 | import * as React from 'react'; | ||
5 | import injectSheet from 'react-jss'; | ||
6 | |||
7 | import { Button, Input } from '@meetfranz/forms'; | ||
8 | import { Classes } from 'jss'; | ||
9 | import { storiesOf } from '../stores/stories'; | ||
10 | |||
11 | const defaultProps = { | ||
12 | label: 'Button', | ||
13 | id: 'test1', | ||
14 | name: 'test1', | ||
15 | type: 'button', | ||
16 | disabled: false, | ||
17 | }; | ||
18 | |||
19 | const styles = { | ||
20 | combinedElements: { | ||
21 | display: 'flex', | ||
22 | justifyContent: 'space-between', | ||
23 | }, | ||
24 | input: { | ||
25 | flex: 1, | ||
26 | marginRight: 20, | ||
27 | }, | ||
28 | }; | ||
29 | |||
30 | const createStore = (args?: any) => observable({ ...defaultProps, ...args }); | ||
31 | |||
32 | const WithStoreButton = observer(({ store }: { store: any }) => ( | ||
33 | <> | ||
34 | <Button | ||
35 | {...{ ...defaultProps, ...store }} | ||
36 | onClick={ | ||
37 | !store.onClick | ||
38 | ? () => { | ||
39 | store.busy = !store.busy; | ||
40 | |||
41 | window.setTimeout(() => { | ||
42 | store.busy = !store.busy; | ||
43 | }, 1000); | ||
44 | } | ||
45 | : store.onClick | ||
46 | } | ||
47 | /> | ||
48 | </> | ||
49 | )); | ||
50 | |||
51 | storiesOf('Button') | ||
52 | .add('Basic', () => <WithStoreButton store={createStore()} />) | ||
53 | .add('Secondary', () => ( | ||
54 | <WithStoreButton | ||
55 | store={createStore({ | ||
56 | buttonType: 'secondary', | ||
57 | })} | ||
58 | /> | ||
59 | )) | ||
60 | .add('Success', () => ( | ||
61 | <WithStoreButton | ||
62 | store={createStore({ | ||
63 | buttonType: 'success', | ||
64 | })} | ||
65 | /> | ||
66 | )) | ||
67 | .add('Warning', () => ( | ||
68 | <WithStoreButton | ||
69 | store={createStore({ | ||
70 | buttonType: 'warning', | ||
71 | })} | ||
72 | /> | ||
73 | )) | ||
74 | .add('Danger', () => ( | ||
75 | <WithStoreButton | ||
76 | store={createStore({ | ||
77 | buttonType: 'danger', | ||
78 | })} | ||
79 | /> | ||
80 | )) | ||
81 | .add('Inverted', () => ( | ||
82 | <WithStoreButton | ||
83 | store={createStore({ | ||
84 | buttonType: 'inverted', | ||
85 | })} | ||
86 | /> | ||
87 | )) | ||
88 | .add('Full width', () => ( | ||
89 | <WithStoreButton | ||
90 | store={createStore({ | ||
91 | stretch: true, | ||
92 | })} | ||
93 | /> | ||
94 | )) | ||
95 | .add('Disabled', () => ( | ||
96 | <WithStoreButton | ||
97 | store={createStore({ | ||
98 | disabled: true, | ||
99 | })} | ||
100 | /> | ||
101 | )) | ||
102 | .add('With loader', () => ( | ||
103 | <WithStoreButton | ||
104 | store={createStore({ | ||
105 | busy: true, | ||
106 | })} | ||
107 | /> | ||
108 | )) | ||
109 | .add('With icon', () => ( | ||
110 | <WithStoreButton | ||
111 | store={createStore({ | ||
112 | icon: mdiInformation, | ||
113 | })} | ||
114 | /> | ||
115 | )) | ||
116 | .add('As link', () => ( | ||
117 | <WithStoreButton | ||
118 | store={createStore({ | ||
119 | href: 'https://meetfranz.com', | ||
120 | })} | ||
121 | /> | ||
122 | )) | ||
123 | .add('As link (target=_blank)', () => ( | ||
124 | <WithStoreButton | ||
125 | store={createStore({ | ||
126 | href: 'https://meetfranz.com', | ||
127 | target: '_blank', | ||
128 | })} | ||
129 | /> | ||
130 | )) | ||
131 | .add('As link (with onClick)', () => ( | ||
132 | <WithStoreButton | ||
133 | store={createStore({ | ||
134 | href: 'https://meetfranz.com', | ||
135 | onClick: (e: React.MouseEvent<HTMLAnchorElement>) => { | ||
136 | e.preventDefault(); | ||
137 | alert('Click event'); | ||
138 | }, | ||
139 | })} | ||
140 | /> | ||
141 | )) | ||
142 | .add('Long multi-line button', () => ( | ||
143 | <WithStoreButton | ||
144 | store={createStore({ | ||
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 | })} | ||
148 | /> | ||
149 | )) | ||
150 | .add( | ||
151 | 'Button with Input', | ||
152 | injectSheet(styles)( | ||
153 | observer(({ classes }: { classes: Classes }) => ( | ||
154 | <div className={classes.combinedElements}> | ||
155 | <Input showLabel={false} className={classes.input} noMargin /> | ||
156 | <WithStoreButton store={createStore({})} /> | ||
157 | </div> | ||
158 | )), | ||
159 | ), | ||
160 | ) | ||
161 | .add( | ||
162 | 'Icon Button with Input', | ||
163 | injectSheet(styles)( | ||
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 | ); | ||