From dee35bd8334c98c17e36e385028f0459d9d9b9e2 Mon Sep 17 00:00:00 2001 From: zhujun24 Date: Mon, 10 Aug 2015 15:39:50 +0800 Subject: [PATCH] optimize code style --- components/datepicker/demo/size.md | 4 +-- components/datepicker/index.jsx | 11 ++++---- components/form/demo/form-controls.md | 2 +- components/form/demo/mix.md | 4 +-- components/input-number/demo/size.md | 4 +-- components/input-number/index.jsx | 11 ++++---- components/select/demo/size.md | 4 +-- components/select/index.jsx | 11 ++++---- style/components/inputNumber.less | 34 ++++++++++++------------ style/components/select.less | 37 ++++++++++++++------------- 10 files changed, 60 insertions(+), 62 deletions(-) diff --git a/components/datepicker/demo/size.md b/components/datepicker/demo/size.md index 06b363a4ea..d4c9cd09a5 100644 --- a/components/datepicker/demo/size.md +++ b/components/datepicker/demo/size.md @@ -11,9 +11,9 @@ var Datepicker = antd.Datepicker; React.render(
- + - +
, document.getElementById('components-datepicker-demo-size')); ```` diff --git a/components/datepicker/index.jsx b/components/datepicker/index.jsx index e833f74b7b..5773d2636b 100644 --- a/components/datepicker/index.jsx +++ b/components/datepicker/index.jsx @@ -64,12 +64,11 @@ export default React.createClass({ showOk={this.props.showTime} showClear={false}/> ); - var sizeClass = ' ant-input-'; - if(this.props.size === 'large'){ - sizeClass += 'lg'; - } - if(this.props.size === 'small'){ - sizeClass += 'sm'; + var sizeClass = ''; + if (this.props.size === 'large') { + sizeClass = ' ant-input-lg'; + } else if (this.props.size === 'small') { + sizeClass = ' ant-input-sm'; } return (
- diff --git a/components/form/demo/mix.md b/components/form/demo/mix.md index fe419c2739..9b49f9474d 100644 --- a/components/form/demo/mix.md +++ b/components/form/demo/mix.md @@ -41,7 +41,7 @@ React.render(
- + 台机器
@@ -71,7 +71,7 @@ React.render(
- diff --git a/components/input-number/demo/size.md b/components/input-number/demo/size.md index 1c9c824f10..6ff3346553 100644 --- a/components/input-number/demo/size.md +++ b/components/input-number/demo/size.md @@ -15,9 +15,9 @@ function onChange(value) { React.render(
- + - +
, document.getElementById('components-input-number-demo-size')); ```` diff --git a/components/input-number/index.jsx b/components/input-number/index.jsx index 4e4da7821e..bcf8f25d4d 100644 --- a/components/input-number/index.jsx +++ b/components/input-number/index.jsx @@ -8,12 +8,11 @@ export default React.createClass({ }; }, render() { - var sizeClass = 'ant-input-number-'; - if(this.props.size === 'large'){ - sizeClass += 'lg'; - } - if(this.props.size === 'small'){ - sizeClass += 'sm'; + var sizeClass = ''; + if (this.props.size === 'large') { + sizeClass = 'ant-input-number-lg'; + } else if (this.props.size === 'small') { + sizeClass = 'ant-input-number-sm'; } return ; } diff --git a/components/select/demo/size.md b/components/select/demo/size.md index 71443ad0a8..85bc0bf9fd 100644 --- a/components/select/demo/size.md +++ b/components/select/demo/size.md @@ -16,7 +16,7 @@ function handleChange(value) { React.render(
- @@ -28,7 +28,7 @@ React.render( - diff --git a/components/select/index.jsx b/components/select/index.jsx index 78b50fd39b..639179abcc 100644 --- a/components/select/index.jsx +++ b/components/select/index.jsx @@ -11,12 +11,11 @@ var AntSelect = React.createClass({ }; }, render() { - var sizeClass = 'ant-select-'; - if(this.props.size === 'large'){ - sizeClass += 'lg'; - } - if(this.props.size === 'small'){ - sizeClass += 'sm'; + var sizeClass = ''; + if (this.props.size === 'large') { + sizeClass = 'ant-select-lg'; + } else if (this.props.size === 'small') { + sizeClass = 'ant-select-sm'; } return (