2017-08-20 21:15:21 +05:30
|
|
|
// @flow
|
|
|
|
import React from 'react';
|
2016-05-02 12:45:42 +05:30
|
|
|
|
|
|
|
import classNames from 'classnames';
|
|
|
|
|
|
|
|
import buttons from 'components/ui/buttons.scss';
|
2017-08-20 21:15:21 +05:30
|
|
|
import { COLOR_GREEN } from 'components/ui';
|
2016-05-02 12:45:42 +05:30
|
|
|
|
2016-05-02 14:50:50 +05:30
|
|
|
import FormComponent from './FormComponent';
|
|
|
|
|
2017-08-20 21:15:21 +05:30
|
|
|
import type { Color } from 'components/ui';
|
|
|
|
|
2016-05-02 14:50:50 +05:30
|
|
|
export default class Button extends FormComponent {
|
2017-08-20 21:15:21 +05:30
|
|
|
props: {
|
|
|
|
label: string | {id: string},
|
|
|
|
block: bool,
|
|
|
|
small: bool,
|
|
|
|
loading: bool,
|
|
|
|
className: string,
|
|
|
|
color: Color
|
2016-05-30 10:10:59 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
static defaultProps = {
|
|
|
|
color: COLOR_GREEN
|
2016-05-02 12:45:42 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
2017-08-20 21:15:21 +05:30
|
|
|
const {
|
|
|
|
color,
|
|
|
|
block,
|
|
|
|
small,
|
|
|
|
className,
|
|
|
|
loading,
|
|
|
|
label,
|
|
|
|
...restProps
|
|
|
|
} = this.props;
|
2016-05-02 12:45:42 +05:30
|
|
|
|
|
|
|
return (
|
|
|
|
<button className={classNames(buttons[color], {
|
2017-08-20 21:15:21 +05:30
|
|
|
[buttons.loading]: loading,
|
2016-05-14 16:56:17 +05:30
|
|
|
[buttons.block]: block,
|
|
|
|
[buttons.smallButton]: small
|
2016-11-06 19:49:52 +05:30
|
|
|
}, className)}
|
2017-08-20 21:15:21 +05:30
|
|
|
{...restProps}
|
2016-07-29 22:44:52 +05:30
|
|
|
>
|
2017-08-20 21:15:21 +05:30
|
|
|
{this.formatMessage(label)}
|
2016-05-02 12:45:42 +05:30
|
|
|
</button>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|