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

37 lines
770 B
TypeScript
Raw Normal View History

2016-09-21 11:54:53 +08:00
import React from 'react';
import classNames from 'classnames';
2015-09-27 16:30:35 +08:00
export type ButtonSize = 'small' | 'large';
2016-07-14 13:29:50 +08:00
2016-09-13 15:31:29 +08:00
export interface ButtonGroupProps {
2016-07-14 13:29:50 +08:00
size?: ButtonSize;
style?: React.CSSProperties;
className?: string;
prefixCls?: string;
2016-07-14 13:29:50 +08:00
}
2017-07-18 16:46:19 +08:00
const ButtonGroup: React.SFC<ButtonGroupProps> = (props) => {
2016-12-19 15:19:15 +08:00
const { prefixCls = 'ant-btn-group', size = '', className, ...others } = props;
// large => lg
// small => sm
let sizeCls = '';
switch (size) {
case 'large':
sizeCls = 'lg';
break;
case 'small':
sizeCls = 'sm';
default:
break;
}
const classes = classNames(prefixCls, {
[`${prefixCls}-${sizeCls}`]: sizeCls,
}, className);
return <div {...others} className={classes} />;
2017-07-18 16:46:19 +08:00
};
export default ButtonGroup;