ant-design/components/dropdown/dropdown-button.jsx
Bruce Mitchener 63c06e8652 Use ES2015 classes instead of React.createClass.
Make Breadcrumb, Checkbox, Dropdown, Steps and Timeline
components use ES2015 classes rather than React.createClass.

This includes:

* getDefaultProps method becomes a defaultProps value on the
  constructor.
* propTypes becomes a value on the constructor.
2016-03-18 09:35:15 +07:00

40 lines
984 B
JavaScript

import React from 'react';
import Button from '../button';
import Icon from '../icon';
import Dropdown from './dropdown';
const ButtonGroup = Button.Group;
import classNames from 'classnames';
export default class DropdownButton extends React.Component {
render() {
const { type, overlay, trigger, align, children, className, ...restProps } = this.props;
const cls = classNames({
'ant-dropdown-button': true,
className: !!className,
});
return (
<ButtonGroup {...restProps} className={cls}>
<Button type={type}>{children}</Button>
<Dropdown align={align} overlay={overlay} trigger={trigger}>
<Button type={type}>
<Icon type="down" />
</Button>
</Dropdown>
</ButtonGroup>
);
}
}
DropdownButton.defaultProps = {
align: {
points: ['tr', 'br'],
overlay: {
adjustX: 1,
adjustY: 1,
},
offset: [0, 4],
targetOffset: [0, 0],
},
type: 'default',
};