ant-design/components/button/button-group.jsx

29 lines
601 B
React
Raw Normal View History

2015-09-27 16:30:35 +08:00
import React from 'react';
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;
// large => lg
// small => sm
const sizeCls = ({
2016-01-05 14:42:06 +08:00
large: 'lg',
small: 'sm',
})[size] || '';
const classes = classNames({
'ant-btn-group': true,
[prefix + sizeCls]: sizeCls,
[className]: className
});
2015-09-27 16:30:35 +08:00
return <div {...others} className={classes} />;
2015-09-27 16:30:35 +08:00
}
}
ButtonGroup.propTypes = {
size: React.PropTypes.string,
};