style: unify demos' code style

This commit is contained in:
Benjy Cui 2015-12-16 15:25:15 +08:00
parent 4bb18780e5
commit 7f2957b23b
16 changed files with 19 additions and 32 deletions

View File

@ -8,7 +8,6 @@
````jsx ````jsx
import { Checkbox } from 'antd'; import { Checkbox } from 'antd';
const container = document.getElementById('components-checkbox-demo-basic');
function onChange(e) { function onChange(e) {
console.log('checked = ' + e.target.checked); console.log('checked = ' + e.target.checked);
@ -17,5 +16,5 @@ function onChange(e) {
ReactDOM.render(<label> ReactDOM.render(<label>
<Checkbox defaultChecked={false} onChange={onChange} /> <Checkbox defaultChecked={false} onChange={onChange} />
Checkbox Checkbox
</label>, container); </label>, document.getElementById('components-checkbox-demo-basic'));
```` ````

View File

@ -8,7 +8,6 @@
````jsx ````jsx
import { Checkbox, Button } from 'antd'; import { Checkbox, Button } from 'antd';
const container = document.getElementById('components-checkbox-demo-controller');
const App = React.createClass({ const App = React.createClass({
getInitialState() { getInitialState() {
@ -56,5 +55,5 @@ const App = React.createClass({
} }
}); });
ReactDOM.render(<App />, container); ReactDOM.render(<App />, document.getElementById('components-checkbox-demo-controller'));
```` ````

View File

@ -8,11 +8,10 @@ checkbox 不可用。
````jsx ````jsx
import { Checkbox } from 'antd'; import { Checkbox } from 'antd';
const container = document.getElementById('components-checkbox-demo-disable');
ReactDOM.render(<div> ReactDOM.render(<div>
<Checkbox defaultChecked={false} disabled /> <Checkbox defaultChecked={false} disabled />
<br /> <br />
<Checkbox defaultChecked disabled /> <Checkbox defaultChecked disabled />
</div>, container); </div>, document.getElementById('components-checkbox-demo-disable'));
```` ````

View File

@ -9,11 +9,10 @@
````jsx ````jsx
import { Steps } from 'antd'; import { Steps } from 'antd';
const Step = Steps.Step; const Step = Steps.Step;
const container = document.getElementById('components-steps-demo-icon');
ReactDOM.render(<Steps> ReactDOM.render(<Steps>
<Step status="finish" title="步骤1" icon="cloud" /> <Step status="finish" title="步骤1" icon="cloud" />
<Step status="process" title="步骤2" icon="apple" /> <Step status="process" title="步骤2" icon="apple" />
<Step status="wait" title="步骤3" icon="github" /> <Step status="wait" title="步骤3" icon="github" />
</Steps>, container); </Steps>, document.getElementById('components-steps-demo-icon'));
```` ````

View File

@ -9,7 +9,6 @@
````jsx ````jsx
import { Steps } from 'antd'; import { Steps } from 'antd';
const Step = Steps.Step; const Step = Steps.Step;
const container = document.getElementById('components-steps-demo-simple');
const steps = [{ const steps = [{
title: '已完成', title: '已完成',
@ -29,5 +28,5 @@ const steps = [{
); );
}); });
ReactDOM.render(<Steps current={1}>{steps}</Steps>, container); ReactDOM.render(<Steps current={1}>{steps}</Steps>, document.getElementById('components-steps-demo-simple'));
```` ````

View File

@ -9,7 +9,6 @@
````jsx ````jsx
import { Steps } from 'antd'; import { Steps } from 'antd';
const Step = Steps.Step; const Step = Steps.Step;
const container = document.getElementById('components-steps-demo-small-size');
const steps = [{ const steps = [{
status: 'finish', status: 'finish',
@ -29,5 +28,5 @@ const steps = [{
); );
}); });
ReactDOM.render(<Steps size="small" current={1}>{steps}</Steps>, container); ReactDOM.render(<Steps size="small" current={1}>{steps}</Steps>, document.getElementById('components-steps-demo-small-size'));
```` ````

View File

@ -9,7 +9,6 @@
````jsx ````jsx
import { Steps } from 'antd'; import { Steps } from 'antd';
const Step = Steps.Step; const Step = Steps.Step;
const container = document.getElementById('components-steps-demo-status');
const steps = [{ const steps = [{
status: 'finish', status: 'finish',
@ -33,5 +32,5 @@ const steps = [{
); );
}); });
ReactDOM.render(<Steps>{steps}</Steps>, container); ReactDOM.render(<Steps>{steps}</Steps>, document.getElementById('components-steps-demo-status'));
```` ````

View File

@ -15,7 +15,6 @@
````jsx ````jsx
import { Steps, Button } from 'antd'; import { Steps, Button } from 'antd';
const Step = Steps.Step; const Step = Steps.Step;
const container = document.getElementById('components-steps-demo-step-next');
const array = Array.apply(null, Array(Math.floor(Math.random() * 3) + 3)); const array = Array.apply(null, Array(Math.floor(Math.random() * 3) + 3));
const steps = array.map(function(item, i) { const steps = array.map(function(item, i) {
return { return {
@ -54,5 +53,5 @@ const App = React.createClass({
} }
}); });
ReactDOM.render(<App />, container); ReactDOM.render(<App />, document.getElementById('components-steps-demo-step-next'));
```` ````

View File

@ -9,7 +9,6 @@
````jsx ````jsx
import { Steps } from 'antd'; import { Steps } from 'antd';
const Step = Steps.Step; const Step = Steps.Step;
const container = document.getElementById('components-steps-demo-vertical-small');
const steps = [{ const steps = [{
title: '已完成', title: '已完成',
@ -26,5 +25,6 @@ const steps = [{
); );
}); });
ReactDOM.render(<Steps size="small" direction="vertical" current={1}>{steps}</Steps>, container); ReactDOM.render(<Steps size="small" direction="vertical" current={1}>{steps}</Steps>,
document.getElementById('components-steps-demo-vertical-small'));
```` ````

View File

@ -9,7 +9,6 @@
````jsx ````jsx
import { Steps } from 'antd'; import { Steps } from 'antd';
const Step = Steps.Step; const Step = Steps.Step;
const container = document.getElementById('components-steps-demo-vertical');
const steps = [{ const steps = [{
title: '已完成', title: '已完成',
@ -29,5 +28,6 @@ const steps = [{
); );
}); });
ReactDOM.render(<Steps direction="vertical" current={1}>{steps}</Steps>, container); ReactDOM.render(<Steps direction="vertical" current={1}>{steps}</Steps>,
document.getElementById('components-steps-demo-vertical'));
```` ````

View File

@ -8,11 +8,11 @@
````jsx ````jsx
import { Switch } from 'antd'; import { Switch } from 'antd';
const container = document.getElementById('components-switch-demo-basic');
function onChange(checked){ function onChange(checked){
console.log('switch to ' + checked); console.log('switch to ' + checked);
} }
ReactDOM.render(<Switch defaultChecked={false} onChange={onChange} />, container); ReactDOM.render(<Switch defaultChecked={false} onChange={onChange} />,
document.getElementById('components-switch-demo-basic'));
```` ````

View File

@ -8,7 +8,6 @@ Switch 失效状态。
````jsx ````jsx
import { Switch, Button } from 'antd'; import { Switch, Button } from 'antd';
const container = document.getElementById('components-switch-demo-disabled');
const Test = React.createClass({ const Test = React.createClass({
getInitialState() { getInitialState() {
@ -31,5 +30,5 @@ const Test = React.createClass({
} }
}); });
ReactDOM.render(<Test />, container); ReactDOM.render(<Test />, document.getElementById('components-switch-demo-disabled'));
```` ````

View File

@ -8,11 +8,10 @@
````jsx ````jsx
import { Switch, Icon } from 'antd'; import { Switch, Icon } from 'antd';
const container = document.getElementById('components-switch-demo-text');
ReactDOM.render(<div> ReactDOM.render(<div>
<Switch checkedChildren="开" unCheckedChildren="关" /> <Switch checkedChildren="开" unCheckedChildren="关" />
<span> </span> <span> </span>
<Switch checkedChildren={<Icon type="check" />} unCheckedChildren={<Icon type="cross" />} /> <Switch checkedChildren={<Icon type="check" />} unCheckedChildren={<Icon type="cross" />} />
</div>, container); </div>, document.getElementById('components-switch-demo-text'));
```` ````

View File

@ -8,7 +8,6 @@
````jsx ````jsx
import { Timeline } from 'antd'; import { Timeline } from 'antd';
const container = document.getElementById('components-timeline-demo-basic');
ReactDOM.render( ReactDOM.render(
<Timeline> <Timeline>
@ -17,5 +16,5 @@ ReactDOM.render(
<Timeline.Item>技术测试异常 2015-09-01</Timeline.Item> <Timeline.Item>技术测试异常 2015-09-01</Timeline.Item>
<Timeline.Item>网络异常正在修复 2015-09-01</Timeline.Item> <Timeline.Item>网络异常正在修复 2015-09-01</Timeline.Item>
</Timeline> </Timeline>
, container); , document.getElementById('components-timeline-demo-basic'));
```` ````

View File

@ -8,7 +8,6 @@
````jsx ````jsx
import { Timeline } from 'antd'; import { Timeline } from 'antd';
const container = document.getElementById('components-timeline-demo-color');
ReactDOM.render( ReactDOM.render(
<Timeline> <Timeline>
@ -25,5 +24,5 @@ ReactDOM.render(
<p>技术测试异常3 2015-09-01</p> <p>技术测试异常3 2015-09-01</p>
</Timeline.Item> </Timeline.Item>
</Timeline> </Timeline>
, container); , document.getElementById('components-timeline-demo-color'));
```` ````

View File

@ -8,7 +8,6 @@
````jsx ````jsx
import { Timeline } from 'antd'; import { Timeline } from 'antd';
const container = document.getElementById('components-timeline-demo-pending');
ReactDOM.render( ReactDOM.render(
<Timeline pending> <Timeline pending>
@ -16,5 +15,5 @@ ReactDOM.render(
<Timeline.Item>初步排除网络异常 2015-09-01</Timeline.Item> <Timeline.Item>初步排除网络异常 2015-09-01</Timeline.Item>
<Timeline.Item>技术测试异常 2015-09-01</Timeline.Item> <Timeline.Item>技术测试异常 2015-09-01</Timeline.Item>
</Timeline> </Timeline>
, container); , document.getElementById('components-timeline-demo-pending'));
```` ````