diff options
author | 2019-06-07 11:25:54 +0200 | |
---|---|---|
committer | 2019-06-07 11:25:54 +0200 | |
commit | 9f2ab40b7602bc3df26ebb093b484b9917768f69 (patch) | |
tree | d00f2833c695cfe5e504fcc87578fe392f396585 /uidev/src | |
parent | Merge pull request #1473 from meetfranz/fix/reset-news-on-logout (diff) | |
download | ferdium-app-9f2ab40b7602bc3df26ebb093b484b9917768f69.tar.gz ferdium-app-9f2ab40b7602bc3df26ebb093b484b9917768f69.tar.zst ferdium-app-9f2ab40b7602bc3df26ebb093b484b9917768f69.zip |
Make buttons flexible in height
Diffstat (limited to 'uidev/src')
-rw-r--r-- | uidev/src/app.tsx | 2 | ||||
-rw-r--r-- | uidev/src/stories/button.stories.tsx | 40 |
2 files changed, 39 insertions, 3 deletions
diff --git a/uidev/src/app.tsx b/uidev/src/app.tsx index 870911c2f..cef22e7a7 100644 --- a/uidev/src/app.tsx +++ b/uidev/src/app.tsx | |||
@@ -2,7 +2,7 @@ import CSS from 'csstype'; | |||
2 | import { Classes } from 'jss'; | 2 | import { Classes } from 'jss'; |
3 | import { observer } from 'mobx-react'; | 3 | import { observer } from 'mobx-react'; |
4 | import DevTools from 'mobx-react-devtools'; | 4 | import DevTools from 'mobx-react-devtools'; |
5 | import React, { Component } from 'react'; | 5 | import React from 'react'; |
6 | import injectSheet from 'react-jss'; | 6 | import injectSheet from 'react-jss'; |
7 | 7 | ||
8 | import { WithTheme } from './withTheme'; | 8 | import { WithTheme } from './withTheme'; |
diff --git a/uidev/src/stories/button.stories.tsx b/uidev/src/stories/button.stories.tsx index c8e9bcbf3..f7537895c 100644 --- a/uidev/src/stories/button.stories.tsx +++ b/uidev/src/stories/button.stories.tsx | |||
@@ -1,8 +1,11 @@ | |||
1 | import { observable } from 'mobx'; | 1 | import { observable } from 'mobx'; |
2 | import { observer } from 'mobx-react'; | 2 | import { observer } from 'mobx-react'; |
3 | import React from 'react'; | 3 | import React from 'react'; |
4 | import injectSheet from 'react-jss'; | ||
4 | 5 | ||
5 | import { Button } from '@meetfranz/forms'; | 6 | import { Button, Input } from '@meetfranz/forms'; |
7 | import { classes } from 'istanbul-lib-coverage'; | ||
8 | import { Classes } from 'jss'; | ||
6 | import { storiesOf } from '../stores/stories'; | 9 | import { storiesOf } from '../stores/stories'; |
7 | 10 | ||
8 | const defaultProps = { | 11 | const defaultProps = { |
@@ -13,6 +16,17 @@ const defaultProps = { | |||
13 | disabled: false, | 16 | disabled: false, |
14 | }; | 17 | }; |
15 | 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 | |||
16 | const createStore = (args?: any) => { | 30 | const createStore = (args?: any) => { |
17 | return observable(Object.assign({}, defaultProps, args)); | 31 | return observable(Object.assign({}, defaultProps, args)); |
18 | }; | 32 | }; |
@@ -99,4 +113,26 @@ storiesOf('Button') | |||
99 | e.preventDefault(); | 113 | e.preventDefault(); |
100 | alert('Click event'); | 114 | alert('Click event'); |
101 | }, | 115 | }, |
102 | })} />)); | 116 | })}/> |
117 | )) | ||
118 | .add('Long multi-line button', () => ( | ||
119 | <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.', | ||
121 | })} /> | ||
122 | )) | ||
123 | .add('Button with Input', injectSheet(styles)(observer(({ classes }: { classes: Classes }) => ( | ||
124 | <div className={classes.combinedElements}> | ||
125 | <Input showLabel={false} className={classes.input} noMargin /> | ||
126 | <WithStoreButton store={createStore({})} /> | ||
127 | </div> | ||
128 | )), | ||
129 | )) | ||
130 | .add('Icon Button with Input', injectSheet(styles)(observer(({ classes }: { classes: Classes }) => ( | ||
131 | <div className={classes.combinedElements}> | ||
132 | <Input showLabel={false} className={classes.input} noMargin /> | ||
133 | <WithStoreButton store={createStore({ | ||
134 | icon: 'mdiInformation', | ||
135 | })} /> | ||
136 | </div> | ||
137 | )), | ||
138 | )); | ||