diff options
Diffstat (limited to 'src/components/ui')
-rw-r--r-- | src/components/ui/FAB.tsx | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/components/ui/FAB.tsx b/src/components/ui/FAB.tsx index 37c3c9ec7..acb0f690e 100644 --- a/src/components/ui/FAB.tsx +++ b/src/components/ui/FAB.tsx | |||
@@ -1,30 +1,28 @@ | |||
1 | /** | 1 | import { Component, ReactElement, ReactNode } from 'react'; |
2 | * Floating Action Button (FAB) | ||
3 | */ | ||
4 | import { Component, ReactChildren } from 'react'; | ||
5 | import { observer } from 'mobx-react'; | 2 | import { observer } from 'mobx-react'; |
6 | import classnames from 'classnames'; | 3 | import classnames from 'classnames'; |
4 | import { noop } from 'lodash'; | ||
7 | 5 | ||
8 | type Props = { | 6 | interface IProps { |
9 | className: string; | 7 | className: string; |
10 | disabled: boolean; | 8 | disabled?: boolean; |
11 | onClick: () => void; | 9 | onClick?: () => void; |
12 | type: string; | 10 | type?: string; |
13 | children: ReactChildren; | 11 | children: ReactNode; |
14 | htmlForm: string; | 12 | htmlForm?: string; |
15 | }; | 13 | } |
16 | |||
17 | class Button extends Component<Props> { | ||
18 | static defaultProps = { | ||
19 | disabled: false, | ||
20 | onClick: () => {}, | ||
21 | type: 'button', | ||
22 | htmlForm: '', | ||
23 | }; | ||
24 | 14 | ||
25 | render() { | 15 | @observer |
26 | const { className, disabled, onClick, type, children, htmlForm } = | 16 | class Button extends Component<IProps> { |
27 | this.props; | 17 | render(): ReactElement { |
18 | const { | ||
19 | className, | ||
20 | disabled = false, | ||
21 | onClick = noop, | ||
22 | type = 'button', | ||
23 | children, | ||
24 | htmlForm = '', | ||
25 | } = this.props; | ||
28 | 26 | ||
29 | const buttonProps = { | 27 | const buttonProps = { |
30 | className: classnames({ | 28 | className: classnames({ |
@@ -45,4 +43,4 @@ class Button extends Component<Props> { | |||
45 | } | 43 | } |
46 | } | 44 | } |
47 | 45 | ||
48 | export default observer(Button); | 46 | export default Button; |