Update button code to make it more clearer (#7929)

* remove unnecessary default value of 'size' prop

* `clicked` should be a state
This commit is contained in:
Zhang Zhi 2017-10-20 10:52:06 +08:00 committed by ddcat1115
parent cf397a27f0
commit 7bc6aad1fd
2 changed files with 4 additions and 4 deletions

View File

@ -11,7 +11,7 @@ export interface ButtonGroupProps {
}
const ButtonGroup: React.SFC<ButtonGroupProps> = (props) => {
const { prefixCls = 'ant-btn-group', size = '', className, ...others } = props;
const { prefixCls = 'ant-btn-group', size, className, ...others } = props;
// large => lg
// small => sm

View File

@ -61,7 +61,6 @@ export default class Button extends React.Component<ButtonProps, any> {
static defaultProps = {
prefixCls: 'ant-btn',
loading: false,
clicked: false,
ghost: false,
};
@ -83,6 +82,7 @@ export default class Button extends React.Component<ButtonProps, any> {
super(props);
this.state = {
loading: props.loading,
clicked: false,
};
}
@ -124,7 +124,7 @@ export default class Button extends React.Component<ButtonProps, any> {
render() {
const {
type, shape, size = '', className, htmlType, children, icon, prefixCls, ghost, ...others,
type, shape, size, className, htmlType, children, icon, prefixCls, ghost, ...others,
} = this.props;
const { loading, clicked } = this.state;
@ -159,7 +159,7 @@ export default class Button extends React.Component<ButtonProps, any> {
return (
<button
{...omit(others, ['loading', 'clicked'])}
{...omit(others, ['loading'])}
type={htmlType || 'button'}
className={classes}
onClick={this.handleClick}