accounts-frontend/src/components/ui/form/Button.js

51 lines
1.1 KiB
JavaScript
Raw Normal View History

// @flow
import React from 'react';
2016-05-02 12:45:42 +05:30
import classNames from 'classnames';
import buttons from 'components/ui/buttons.scss';
import { COLOR_GREEN } from 'components/ui';
2016-05-02 12:45:42 +05:30
import FormComponent from './FormComponent';
import type { Color } from 'components/ui';
export default class Button extends FormComponent {
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() {
const {
color,
block,
small,
className,
loading,
label,
...restProps
} = this.props;
2016-05-02 12:45:42 +05:30
return (
<button className={classNames(buttons[color], {
[buttons.loading]: loading,
2016-05-14 16:56:17 +05:30
[buttons.block]: block,
[buttons.smallButton]: small
}, className)}
{...restProps}
>
{this.formatMessage(label)}
2016-05-02 12:45:42 +05:30
</button>
);
}
}