mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-03 08:19:37 +08:00
63c06e8652
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.
27 lines
667 B
JavaScript
27 lines
667 B
JavaScript
import RcCheckbox from 'rc-checkbox';
|
|
import React from 'react';
|
|
import Group from './Group';
|
|
import classNames from 'classnames';
|
|
|
|
export default class Checkbox extends React.Component {
|
|
render() {
|
|
const { prefixCls, style, children, className, ...restProps } = this.props;
|
|
const classString = classNames({
|
|
[className]: !!className,
|
|
[`${prefixCls}-wrapper`]: true,
|
|
});
|
|
return (
|
|
<label className={classString} style={style}>
|
|
<RcCheckbox {...restProps} prefixCls={prefixCls} children={null} />
|
|
{children}
|
|
</label>
|
|
);
|
|
}
|
|
}
|
|
|
|
Checkbox.defaultProps = {
|
|
prefixCls: 'ant-checkbox'
|
|
};
|
|
|
|
Checkbox.Group = Group;
|