diff --git a/components/checkbox/Group.jsx b/components/checkbox/Group.jsx index e9b353856d..43d1bc39ea 100644 --- a/components/checkbox/Group.jsx +++ b/components/checkbox/Group.jsx @@ -51,12 +51,12 @@ export default React.createClass({
{ options.map(option => - + ) }
diff --git a/components/checkbox/demo/basic.md b/components/checkbox/demo/basic.md index b642019a4b..c19da248c9 100644 --- a/components/checkbox/demo/basic.md +++ b/components/checkbox/demo/basic.md @@ -13,8 +13,7 @@ function onChange(e) { console.log(`checked = ${e.target.checked}`); } -ReactDOM.render(, mountNode); +ReactDOM.render( + Checkbox +, mountNode); ```` diff --git a/components/checkbox/demo/controller.md b/components/checkbox/demo/controller.md index ff636c333e..e84a0cc4ab 100644 --- a/components/checkbox/demo/controller.md +++ b/components/checkbox/demo/controller.md @@ -21,25 +21,24 @@ const App = React.createClass({ return (

- -

-

- - -

-
+ + {label} + +

+

+ + +

+ ); }, toggleChecked() { diff --git a/components/checkbox/index.jsx b/components/checkbox/index.jsx index b04ab10b61..dca2cefda4 100644 --- a/components/checkbox/index.jsx +++ b/components/checkbox/index.jsx @@ -1,6 +1,7 @@ import RcCheckbox from 'rc-checkbox'; import React from 'react'; import Group from './Group'; +import classNames from 'classnames'; const Checkbox = React.createClass({ getDefaultProps() { @@ -9,7 +10,17 @@ const Checkbox = React.createClass({ }; }, render() { - return ; + const { prefixCls, style, children, className, ...restProps } = this.props; + const classString = classNames({ + [className]: !!className, + [`${prefixCls}-wrapper`]: true, + }); + return ( + + ); } }); diff --git a/components/form/demo/form-controls.md b/components/form/demo/form-controls.md index d616e0ede6..74544df378 100644 --- a/components/form/demo/form-controls.md +++ b/components/form/demo/form-controls.md @@ -53,42 +53,30 @@ ReactDOM.render( label="Checkbox 多选框:" labelCol={{ span: 6 }} wrapperCol={{ span: 18 }} > - - - + 选项一 + 选项二 + 选项三(不可选) - - - + 选项一 + 选项二 + 选项三 - - A - B - C - D - + + A + B + C + D + , mountNode); diff --git a/style/components/checkbox.less b/style/components/checkbox.less index d94456cd36..ce84948e39 100644 --- a/style/components/checkbox.less +++ b/style/components/checkbox.less @@ -2,11 +2,10 @@ .antCheckboxFn(@checkbox-prefix-cls: ant-checkbox) { -@checkbox-wrap-prefix-cls: @checkbox-prefix-cls; -@checkbox-inner-prefix-cls: ~"@{checkbox-wrap-prefix-cls}-inner"; +@checkbox-inner-prefix-cls: ~"@{checkbox-prefix-cls}-inner"; // 一般状态 -.@{checkbox-wrap-prefix-cls} { +.@{checkbox-prefix-cls} { white-space: nowrap; cursor: pointer; outline: none; @@ -66,7 +65,7 @@ } // 半选状态 -.@{checkbox-wrap-prefix-cls}-indeterminate { +.@{checkbox-prefix-cls}-indeterminate { .@{checkbox-inner-prefix-cls} { border-color: @primary-color; background-color: @primary-color; @@ -87,7 +86,7 @@ } } // 选中状态 -.@{checkbox-wrap-prefix-cls}-checked { +.@{checkbox-prefix-cls}-checked { &:hover { .@{checkbox-inner-prefix-cls} { @@ -116,9 +115,9 @@ } } -.@{checkbox-wrap-prefix-cls}-disabled { +.@{checkbox-prefix-cls}-disabled { - &.@{checkbox-wrap-prefix-cls}-checked { + &.@{checkbox-prefix-cls}-checked { &:hover { .@{checkbox-inner-prefix-cls} { @@ -157,11 +156,16 @@ } } -.@{checkbox-wrap-prefix-cls} + span { +.@{checkbox-prefix-cls}-wrapper { + cursor: pointer; +} + +.@{checkbox-prefix-cls}-wrapper + span, +.@{checkbox-prefix-cls} + span { margin-left: 8px; } -.@{checkbox-wrap-prefix-cls}-group { +.@{checkbox-prefix-cls}-group { font-size: @font-size-base; &-item { display: inline-block;