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-';
|
|
|
|
|
2016-04-13 17:38:53 +08:00
|
|
|
export default function ButtonGroup(props) {
|
|
|
|
const { size, className, ...others } = props;
|
2016-03-29 14:01:10 +08:00
|
|
|
|
2016-04-13 17:38:53 +08:00
|
|
|
// large => lg
|
|
|
|
// small => sm
|
|
|
|
const sizeCls = ({
|
|
|
|
large: 'lg',
|
|
|
|
small: 'sm',
|
|
|
|
})[size] || '';
|
2015-10-22 21:01:52 +08:00
|
|
|
|
2016-04-13 17:38:53 +08:00
|
|
|
const classes = classNames({
|
|
|
|
'ant-btn-group': true,
|
|
|
|
[prefix + sizeCls]: sizeCls,
|
|
|
|
[className]: className
|
|
|
|
});
|
2015-10-22 21:01:52 +08:00
|
|
|
|
2016-04-13 17:38:53 +08:00
|
|
|
return <div {...others} className={classes} />;
|
2015-09-27 16:30:35 +08:00
|
|
|
}
|
2016-04-13 17:38:53 +08:00
|
|
|
|
|
|
|
ButtonGroup.propTypes = {
|
|
|
|
size: React.PropTypes.oneOf(['large', 'small']),
|
|
|
|
};
|