2015-09-27 16:30:35 +08:00
|
|
|
import React from 'react';
|
2015-11-24 20:03:57 +08:00
|
|
|
import classNames from 'classnames';
|
2015-09-27 16:30:35 +08:00
|
|
|
|
|
|
|
const prefix = 'ant-btn-group-';
|
|
|
|
|
|
|
|
export default class ButtonGroup extends React.Component {
|
|
|
|
render() {
|
2016-01-05 14:42:06 +08:00
|
|
|
const { size, className, ...others } = this.props;
|
2015-10-22 21:01:52 +08:00
|
|
|
|
|
|
|
// large => lg
|
|
|
|
// small => sm
|
|
|
|
const sizeCls = ({
|
2016-01-05 14:42:06 +08:00
|
|
|
large: 'lg',
|
|
|
|
small: 'sm',
|
2015-10-22 21:01:52 +08:00
|
|
|
})[size] || '';
|
|
|
|
|
2015-11-24 20:03:57 +08:00
|
|
|
const classes = classNames({
|
2015-10-09 16:42:08 +08:00
|
|
|
'ant-btn-group': true,
|
2015-10-22 21:01:52 +08:00
|
|
|
[prefix + sizeCls]: sizeCls,
|
2015-10-09 16:42:08 +08:00
|
|
|
[className]: className
|
|
|
|
});
|
2015-09-27 16:30:35 +08:00
|
|
|
|
2015-10-09 16:42:08 +08:00
|
|
|
return <div {...others} className={classes} />;
|
2015-09-27 16:30:35 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ButtonGroup.propTypes = {
|
|
|
|
size: React.PropTypes.string,
|
|
|
|
};
|