You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.1 KiB
41 lines
1.1 KiB
9 years ago
|
import React from 'react';
|
||
|
import Button from '../button';
|
||
|
import Icon from '../icon';
|
||
|
import Dropdown from './dropdown';
|
||
|
const ButtonGroup = Button.Group;
|
||
9 years ago
|
import classNames from 'classnames';
|
||
9 years ago
|
import splitObject from '../_util/splitObject';
|
||
9 years ago
|
export default class DropdownButton extends React.Component {
|
||
9 years ago
|
static defaultProps = {
|
||
|
align: {
|
||
|
points: ['tr', 'br'],
|
||
|
overlay: {
|
||
|
adjustX: 1,
|
||
|
adjustY: 1,
|
||
|
},
|
||
|
offset: [0, 4],
|
||
|
targetOffset: [0, 0],
|
||
|
},
|
||
|
type: 'default',
|
||
|
}
|
||
|
|
||
9 years ago
|
render() {
|
||
9 years ago
|
const [{ type, overlay, trigger, align, children, className, onClick },restProps] = splitObject(this.props,
|
||
|
['type', 'overlay', 'trigger', 'align', 'children', 'className', 'onClick']);
|
||
9 years ago
|
const cls = classNames({
|
||
|
'ant-dropdown-button': true,
|
||
9 years ago
|
[className]: !!className,
|
||
9 years ago
|
});
|
||
9 years ago
|
return (
|
||
9 years ago
|
<ButtonGroup {...restProps} className={cls}>
|
||
9 years ago
|
<Button type={type} onClick={onClick}>{children}</Button>
|
||
9 years ago
|
<Dropdown align={align} overlay={overlay} trigger={trigger}>
|
||
|
<Button type={type}>
|
||
9 years ago
|
<Icon type="down" />
|
||
|
</Button>
|
||
|
</Dropdown>
|
||
|
</ButtonGroup>
|
||
|
);
|
||
9 years ago
|
}
|
||
9 years ago
|
}
|