diff options
Diffstat (limited to 'src/components/ui/FAB.js')
-rw-r--r-- | src/components/ui/FAB.js | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/src/components/ui/FAB.js b/src/components/ui/FAB.js deleted file mode 100644 index 55fe97e82..000000000 --- a/src/components/ui/FAB.js +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | /** | ||
2 | * Floating Action Button (FAB) | ||
3 | */ | ||
4 | import { Component } from 'react'; | ||
5 | import PropTypes from 'prop-types'; | ||
6 | import { observer } from 'mobx-react'; | ||
7 | import classnames from 'classnames'; | ||
8 | |||
9 | import { oneOrManyChildElements } from '../../prop-types'; | ||
10 | |||
11 | @observer | ||
12 | class Button extends Component { | ||
13 | static propTypes = { | ||
14 | className: PropTypes.string, | ||
15 | disabled: PropTypes.bool, | ||
16 | onClick: PropTypes.func, | ||
17 | type: PropTypes.string, | ||
18 | children: oneOrManyChildElements.isRequired, | ||
19 | htmlForm: PropTypes.string, | ||
20 | }; | ||
21 | |||
22 | static defaultProps = { | ||
23 | className: null, | ||
24 | disabled: false, | ||
25 | onClick: () => {}, | ||
26 | type: 'button', | ||
27 | htmlForm: '', | ||
28 | }; | ||
29 | |||
30 | element = null; | ||
31 | |||
32 | render() { | ||
33 | const { className, disabled, onClick, type, children, htmlForm } = | ||
34 | this.props; | ||
35 | |||
36 | const buttonProps = { | ||
37 | className: classnames({ | ||
38 | ferdi__fab: true, | ||
39 | [`${className}`]: className, | ||
40 | }), | ||
41 | type, | ||
42 | }; | ||
43 | |||
44 | if (disabled) { | ||
45 | buttonProps.disabled = true; | ||
46 | } | ||
47 | |||
48 | if (onClick) { | ||
49 | buttonProps.onClick = onClick; | ||
50 | } | ||
51 | |||
52 | if (htmlForm) { | ||
53 | buttonProps.form = htmlForm; | ||
54 | } | ||
55 | |||
56 | return ( | ||
57 | // disabling rule as button has type defined in `buttonProps` | ||
58 | <button {...buttonProps} type="button"> | ||
59 | {children} | ||
60 | </button> | ||
61 | ); | ||
62 | } | ||
63 | } | ||
64 | |||
65 | export default Button; | ||