2016-05-02 14:50:50 +05:30
|
|
|
import React, { PropTypes } from 'react';
|
2016-05-02 12:45:42 +05:30
|
|
|
|
|
|
|
import classNames from 'classnames';
|
|
|
|
|
|
|
|
import buttons from 'components/ui/buttons.scss';
|
|
|
|
|
2016-05-02 14:50:50 +05:30
|
|
|
import FormComponent from './FormComponent';
|
|
|
|
|
|
|
|
export default class Button extends FormComponent {
|
2016-05-02 12:45:42 +05:30
|
|
|
static displayName = 'Button';
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
label: PropTypes.oneOfType([
|
|
|
|
PropTypes.shape({
|
|
|
|
id: PropTypes.string
|
|
|
|
}),
|
|
|
|
PropTypes.string
|
|
|
|
]).isRequired,
|
|
|
|
block: PropTypes.bool,
|
2016-05-02 23:02:03 +05:30
|
|
|
color: PropTypes.oneOf(['green', 'blue', 'red', 'lightViolet', 'darkBlue', 'violet'])
|
2016-05-02 12:45:42 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { color = 'green', block } = this.props;
|
|
|
|
|
|
|
|
const props = {
|
|
|
|
...this.props
|
|
|
|
};
|
|
|
|
|
2016-05-02 14:50:50 +05:30
|
|
|
props.label = this.formatMessage(props.label);
|
2016-05-02 12:45:42 +05:30
|
|
|
|
|
|
|
return (
|
|
|
|
<button className={classNames(buttons[color], {
|
|
|
|
[buttons.block]: block
|
|
|
|
})} {...props}>
|
|
|
|
{props.label}
|
|
|
|
</button>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|