unify size api name

This commit is contained in:
zhujun24 2015-08-10 13:22:50 +08:00
parent e3e17376f0
commit ea3f38a58a
9 changed files with 35 additions and 14 deletions

View File

@ -11,9 +11,9 @@ var Datepicker = antd.Datepicker;
React.render(
<div>
<Datepicker size="lg" />
<Datepicker size={"large"} />
<Datepicker />
<Datepicker size="sm" />
<Datepicker size={"small"} />
</div>
, document.getElementById('components-datepicker-demo-size'));
````

View File

@ -64,6 +64,13 @@ 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';
}
return (
<Datepicker
transitionName={this.props.transitionName}
@ -81,7 +88,7 @@ export default React.createClass({
onChange={this.handleChange}>
<input
placeholder={this.props.placeholder}
className={'ant-calendar-picker-input ant-input ant-input-' + this.props.size}/>
className={'ant-calendar-picker-input ant-input' + sizeClass}/>
</Datepicker>
);
}

View File

@ -27,7 +27,7 @@
| onSelect | 选择日期的回调 | function | 无 |
| showTime | 显示时间选择条 | boolean | false |
| disabled | 禁用 | bool | false |
| size | 输入框大小,`lg`代表高为32px`sm`代表高为22px默认28px | string | 无 |
| size | 输入框大小,`large`代表高为32px`small`代表高为22px默认28px | string | 无 |
<style>
.code-box-demo .ant-calendar-picker-input {

View File

@ -2,7 +2,7 @@
- order: 1
三种大小的数字输入框,当 className 分别为 `ant-input-number-lg``ant-input-number-sm` 时,输入框高度为 `32px``22px` ,默认高度为 `28px`
三种大小的数字输入框,当 size 分别为 `large``small` 时,输入框高度为 `32px``22px` ,默认高度为 `28px`
---
@ -15,9 +15,9 @@ function onChange(value) {
React.render(
<div>
<InputNumber className="ant-input-number-lg" min={1} max={100000} defaultValue={3} onChange={onChange} />
<InputNumber size={"large"} min={1} max={100000} defaultValue={3} onChange={onChange} />
<InputNumber min={1} max={100000} defaultValue={3} onChange={onChange} />
<InputNumber className="ant-input-number-sm" min={1} max={100000} defaultValue={3} onChange={onChange} />
<InputNumber size={"small"} min={1} max={100000} defaultValue={3} onChange={onChange} />
</div>
, document.getElementById('components-input-number-demo-size'));
````

View File

@ -8,6 +8,13 @@ export default React.createClass({
};
},
render() {
return <InputNumber style={{width: 90}} {...this.props} />;
var sizeClass = 'ant-input-number-';
if(this.props.size === 'large'){
sizeClass += 'lg';
}
if(this.props.size === 'small'){
sizeClass += 'sm';
}
return <InputNumber className={sizeClass} style={{width: 90}} {...this.props} />;
}
});

View File

@ -25,4 +25,4 @@
| defaultValue | 初始值 | Number | |
| onChange | 变化回调 | Function | |
| disabled | 禁用 | Boolean | false |
| className | 输入框大小 | String | 无 |
| size | 输入框大小 | String | 无 |

View File

@ -2,7 +2,7 @@
- order: 0
三种大小的选择框,当 className 分别为 `ant-select-lg``ant-select-sm` 时,输入框高度为 `32px``22px` ,默认高度为 `28px`
三种大小的选择框,当 size 分别为 `large``small` 时,输入框高度为 `32px``22px` ,默认高度为 `28px`
---
@ -16,7 +16,7 @@ function handleChange(value) {
React.render(
<div>
<Select className="ant-select-lg" value="lucy" style={{width:200}} onChange={handleChange}>
<Select size={"large"} value="lucy" style={{width:200}} onChange={handleChange}>
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
<Option value="disabled" disabled>Disabled</Option>
@ -28,7 +28,7 @@ React.render(
<Option value="disabled" disabled>Disabled</Option>
<Option value="yiminghe">yiminghe</Option>
</Select>
<Select className="ant-select-sm" value="lucy" style={{width:200}} onChange={handleChange}>
<Select size={"small"} value="lucy" style={{width:200}} onChange={handleChange}>
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
<Option value="disabled" disabled>Disabled</Option>

View File

@ -11,8 +11,15 @@ var AntSelect = React.createClass({
};
},
render() {
var sizeClass = 'ant-select-';
if(this.props.size === 'large'){
sizeClass += 'lg';
}
if(this.props.size === 'small'){
sizeClass += 'sm';
}
return (
<Select {...this.props} />
<Select className={sizeClass} {...this.props} />
);
}
});

View File

@ -36,7 +36,7 @@
| placeholder | 选择框默认文字 | string | 无 |
| searchPlaceholder | 搜索框默认文字 | string | 无 |
| combobox | 输入框自动提示模式 | | false |
| className | 选择框大小 | String | 无 |
| size | 选择框大小 | String | 无 |
### Option props