1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
import { Component } from 'react';
import { observer, inject } from 'mobx-react';
import Loader from 'react-loader';
import classnames from 'classnames';
import { FerdiStores } from '../../stores.types';
type Props = {
className: string;
label: string;
disabled: boolean;
onClick: () => void;
type: 'button' | 'submit' | 'reset';
buttonType: string;
loaded: boolean;
htmlForm: string;
stores: FerdiStores;
};
@inject('stores')
@observer
class Button extends Component<Props> {
static defaultProps = {
className: null,
disabled: false,
onClick: () => {},
type: 'button',
buttonType: '',
loaded: true,
htmlForm: '',
};
render() {
const {
label,
className,
disabled,
onClick,
type,
buttonType,
loaded,
htmlForm,
} = this.props;
return (
<button
className={classnames({
'franz-form__button': true,
[`franz-form__button--${buttonType}`]: buttonType,
[`${className}`]: className,
})}
disabled={disabled}
type={type}
onClick={onClick}
form={htmlForm}
>
<Loader
loaded={loaded}
lines={10}
scale={0.4}
color={
buttonType !== 'secondary'
? '#FFF'
: this.props.stores.settings.app.accentColor
}
component="span"
/>
{label}
</button>
);
}
}
export default Button;
|