2015-12-02 15:18:15 +08:00
|
|
|
import React from 'react';
|
|
|
|
import Button from '../button';
|
|
|
|
import Icon from '../icon';
|
|
|
|
import Dropdown from './dropdown';
|
|
|
|
const ButtonGroup = Button.Group;
|
2016-02-29 18:02:05 +08:00
|
|
|
import classNames from 'classnames';
|
2015-12-02 15:18:15 +08:00
|
|
|
|
|
|
|
export default React.createClass({
|
|
|
|
getDefaultProps() {
|
|
|
|
return {
|
2016-02-29 18:02:05 +08:00
|
|
|
align: {
|
|
|
|
points: ['tr', 'br'],
|
|
|
|
overlay: {
|
|
|
|
adjustX: 1,
|
|
|
|
adjustY: 1,
|
|
|
|
},
|
|
|
|
offset: [0, 4],
|
|
|
|
targetOffset: [0, 0],
|
|
|
|
},
|
2015-12-02 15:18:15 +08:00
|
|
|
type: 'default',
|
|
|
|
};
|
|
|
|
},
|
|
|
|
render() {
|
2016-04-18 17:23:22 +08:00
|
|
|
const { type, overlay, trigger, align, children, className, onClick, ...restProps } = this.props;
|
2016-02-29 18:02:05 +08:00
|
|
|
const cls = classNames({
|
|
|
|
'ant-dropdown-button': true,
|
|
|
|
className: !!className,
|
|
|
|
});
|
2016-01-07 14:21:29 +08:00
|
|
|
return (
|
2016-02-29 18:02:05 +08:00
|
|
|
<ButtonGroup {...restProps} className={cls}>
|
2016-04-18 17:23:22 +08:00
|
|
|
<Button type={type} onClick={onClick}>{children}</Button>
|
2016-02-29 18:02:05 +08:00
|
|
|
<Dropdown align={align} overlay={overlay} trigger={trigger}>
|
|
|
|
<Button type={type}>
|
2016-01-07 14:21:29 +08:00
|
|
|
<Icon type="down" />
|
|
|
|
</Button>
|
|
|
|
</Dropdown>
|
|
|
|
</ButtonGroup>
|
|
|
|
);
|
2015-12-02 15:18:15 +08:00
|
|
|
}
|
|
|
|
});
|