diff --git a/components/switch/demo/basic.md b/components/switch/demo/basic.md index 5861907c29..eeda0e74f7 100644 --- a/components/switch/demo/basic.md +++ b/components/switch/demo/basic.md @@ -1,8 +1,8 @@ -# 用法示例 +# 简单 - order: 0 -switch 用法 +最简单的用法。 --- @@ -14,22 +14,5 @@ function onChange(checked){ console.log('switch to ' + checked); } -React.render(
-

-simple:  -
  -

-

-disabled:  -
  -

-

-children:  -
  -

-

-icon children:  -} unCheckedChildren={}/> -

-
, container); +React.render(, container); ```` diff --git a/components/switch/demo/disabled.md b/components/switch/demo/disabled.md new file mode 100644 index 0000000000..5deebd7140 --- /dev/null +++ b/components/switch/demo/disabled.md @@ -0,0 +1,35 @@ +# 简单 + +- order: 1 + +最简单的用法。 + +--- + +````jsx +var Switch = antd.Switch; +var container = document.getElementById('components-switch-demo-disabled'); + +var Test = React.createClass({ + getInitialState() { + return { + disabled: false + } + }, + toggle(){ + this.setState({ + disabled: !this.state.disabled + }); + }, + render() { + return
+ +
+
+ +
; + } +}); + +React.render(, container); +```` diff --git a/components/switch/demo/text.md b/components/switch/demo/text.md new file mode 100644 index 0000000000..6d09eeb2f3 --- /dev/null +++ b/components/switch/demo/text.md @@ -0,0 +1,18 @@ +# 文字和图标 + +- order: 2 + +带有文字和图标。 + +--- + +````jsx +var Switch = antd.Switch; +var container = document.getElementById('components-switch-demo-text'); + +React.render(
+ + + } unCheckedChildren={} /> +
, container); +```` diff --git a/style/components/switch.less b/style/components/switch.less index cb8a365f68..0570b61b12 100644 --- a/style/components/switch.less +++ b/style/components/switch.less @@ -1,6 +1,6 @@ @switchPrefixCls:ant-switch; -@duration:.3s; +@switch-duration:.3s; .@{switchPrefixCls}{ position: relative; @@ -14,7 +14,7 @@ border: 1px solid #ccc; background-color: #ccc; cursor: pointer; - transition: all @duration cubic-bezier(0.35, 0, 0.25, 1); + transition: all @switch-duration cubic-bezier(0.35, 0, 0.25, 1); &-inner { color:#fff; @@ -29,15 +29,15 @@ height: 18px; left: 2px; top:1px; - border-radius: 50% 50%; + border-radius: 100%; background-color: #ffffff; content: " "; cursor: pointer; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.26); transform: scale(1); - transition: left @duration cubic-bezier(0.35, 0, 0.25, 1); + transition: left @switch-duration cubic-bezier(0.35, 0, 0.25, 1); animation-timing-function: cubic-bezier(0.35, 0, 0.25, 1); - animation-duration: @duration; + animation-duration: @switch-duration; animation-name: rcSwitchOff; }