docs: fix code style

This commit is contained in:
Benjy Cui 2017-05-15 14:37:22 +08:00
parent 61d6cf14ff
commit 12a6060304
17 changed files with 103 additions and 49 deletions

View File

@ -60,26 +60,29 @@ function renderTitle(title) {
);
}
const options = dataSource.map(group =>
const options = dataSource.map(group => (
<OptGroup
key={group.title}
label={renderTitle(group.title)}
>
{group.children.map(opt =>
{group.children.map(opt => (
<Option key={opt.title} value={opt.title}>
{opt.title}
<span className="certain-search-item-count">{opt.count} 人 关注</span>
</Option>)
}
</OptGroup>).concat([
<Option disabled key="all" className="show-all">
<a
href="https://www.google.com/search?q=antd"
target="_blank"
rel="noopener noreferrer"
>查看所有结果</a>
</Option>,
]);
</Option>
))}
</OptGroup>
)).concat([
<Option disabled key="all" className="show-all">
<a
href="https://www.google.com/search?q=antd"
target="_blank"
rel="noopener noreferrer"
>
查看所有结果
</a>
</Option>,
]);
function Complete() {
return (

View File

@ -49,12 +49,12 @@ function dateCellRender(value) {
return (
<ul className="events">
{
listData.map(item =>
listData.map(item => (
<li key={item.content}>
<span className={`event-${item.type}`}></span>
{item.content}
</li>
)
))
}
</ul>
);

View File

@ -50,8 +50,11 @@ function displayRender(label) {
}
ReactDOM.render(
<Cascader options={options} expandTrigger="hover"
displayRender={displayRender} onChange={onChange}
<Cascader
options={options}
expandTrigger="hover"
displayRender={displayRender}
onChange={onChange}
/>
, mountNode);
````

View File

@ -34,13 +34,17 @@ class App extends React.Component {
</Checkbox>
</p>
<p>
<Button type="primary" size="small"
<Button
type="primary"
size="small"
onClick={this.toggleChecked}
>
{!this.state.checked ? 'Check' : 'Uncheck'}
</Button>
<Button style={{ marginLeft: '10px' }}
type="primary" size="small"
<Button
style={{ marginLeft: '10px' }}
type="primary"
size="small"
onClick={this.toggleDisable}
>
{!this.state.disabled ? 'Disable' : 'Enable'}

View File

@ -31,7 +31,9 @@ ReactDOM.render(
<br />
<RangePicker
ranges={{ Today: [moment(), moment()], 'This Month': [moment(), moment().endOf('month')] }}
showTime format="YYYY/MM/DD HH:mm:ss" onChange={onChange}
showTime
format="YYYY/MM/DD HH:mm:ss"
onChange={onChange}
/>
</div>,
mountNode

View File

@ -40,7 +40,8 @@ ReactDOM.render(
Dropdown
</Dropdown.Button>
<Dropdown.Button
onClick={handleButtonClick} overlay={menu}
onClick={handleButtonClick}
overlay={menu}
disabled
style={{ marginLeft: 8 }}
>

View File

@ -35,13 +35,18 @@ class CustomNavMention extends React.Component {
const filtered = webFrameworks.filter(item =>
item.name.toLowerCase().indexOf(searchValue) !== -1
);
const suggestions = filtered.map(suggestion =>
<Nav value={suggestion.name} data={suggestion} disabled={suggestion.disabled}>
const suggestions = filtered.map(suggestion => (
<Nav
value={suggestion.name}
data={suggestion}
disabled={suggestion.disabled}
>
<span>
<img alt={suggestion.name} style={{ height: 16, width: 16, marginRight: 5, float: 'left' }} src={suggestion.icon} />
{suggestion.name} - {suggestion.type}
</span>
</Nav>);
</Nav>
));
this.setState({ suggestions });
}
render() {

View File

@ -40,10 +40,14 @@ class CustomNavMention extends React.Component {
const filtered = webFrameworks.filter(item =>
item.name.toLowerCase().indexOf(searchValue) !== -1
);
const suggestions = filtered.map(suggestion =>
<Nav value={suggestion.name} data={suggestion}>
const suggestions = filtered.map(suggestion => (
<Nav
value={suggestion.name}
data={suggestion}
>
<span>{suggestion.name} - {suggestion.type}</span>
</Nav>);
</Nav>
));
this.setState({ suggestions });
}
render() {

View File

@ -39,8 +39,11 @@ class App extends React.Component {
return (
<div>
<Button type="primary" onClick={this.showModal}>Open a modal dialog</Button>
<Modal title="Basic Modal" visible={this.state.visible}
onOk={this.handleOk} onCancel={this.handleCancel}
<Modal
title="Basic Modal"
visible={this.state.visible}
onOk={this.handleOk}
onCancel={this.handleCancel}
>
<p>some contents...</p>
<p>some contents...</p>

View File

@ -37,9 +37,13 @@ class LocalizedModal extends React.Component {
return (
<div>
<Button type="primary" onClick={this.showModal}>Show Modal</Button>
<Modal title="Modal" visible={this.state.visible}
onOk={this.handleOk} onCancel={this.handleCancel}
okText="OK" cancelText="Cancel"
<Modal
title="Modal"
visible={this.state.visible}
onOk={this.handleOk}
onCancel={this.handleCancel}
okText="OK"
cancelText="Cancel"
>
<p>Bla bla ...</p>
<p>Bla bla ...</p>

View File

@ -48,9 +48,12 @@ class App extends React.Component {
render() {
return (
<div>
<Popconfirm title="Are you sure delete this task?"
visible={this.state.visible} onVisibleChange={this.handleVisibleChange}
onConfirm={this.confirm} onCancel={this.cancel}
<Popconfirm
title="Are you sure delete this task?"
visible={this.state.visible}
onVisibleChange={this.handleVisibleChange}
onConfirm={this.confirm}
onCancel={this.cancel}
okText="Yes"
cancelText="No"
>

View File

@ -32,8 +32,12 @@ class IntegerStep extends React.Component {
<Slider min={1} max={20} onChange={this.onChange} value={this.state.inputValue} />
</Col>
<Col span={4}>
<InputNumber min={1} max={20} style={{ marginLeft: 16 }}
value={this.state.inputValue} onChange={this.onChange}
<InputNumber
min={1}
max={20}
style={{ marginLeft: 16 }}
value={this.state.inputValue}
onChange={this.onChange}
/>
</Col>
</Row>
@ -57,8 +61,13 @@ class DecimalStep extends React.Component {
<Slider min={0} max={1} onChange={this.onChange} value={this.state.inputValue} step={0.01} />
</Col>
<Col span={4}>
<InputNumber min={0} max={1} style={{ marginLeft: 16 }} step={0.01}
value={this.state.inputValue} onChange={this.onChange}
<InputNumber
min={0}
max={1}
style={{ marginLeft: 16 }}
step={0.01}
value={this.state.inputValue}
onChange={this.onChange}
/>
</Col>
</Row>

View File

@ -67,9 +67,14 @@ class App extends React.Component {
return (
<div>
<div style={{ marginBottom: 16 }}>
<Button type="primary" onClick={this.start}
disabled={!hasSelected} loading={loading}
>Reload</Button>
<Button
type="primary"
onClick={this.start}
disabled={!hasSelected}
loading={loading}
>
Reload
</Button>
<span style={{ marginLeft: 8 }}>{hasSelected ? `Selected ${selectedRowKeys.length} items` : ''}</span>
</div>
<Table rowSelection={rowSelection} columns={columns} dataSource={data} />

View File

@ -31,7 +31,9 @@ class Demo extends React.Component {
<div>
<div style={{ marginBottom: 16 }}>
Tab position
<Select value={this.state.tabPosition} onChange={this.changeTabPosition}
<Select
value={this.state.tabPosition}
onChange={this.changeTabPosition}
dropdownMatchSelectWidth={false}
>
<Option value="top">top</Option>

View File

@ -71,7 +71,8 @@ class EditableTagGroup extends React.Component {
{inputVisible && (
<Input
ref={this.saveInputRef}
type="text" size="small"
type="text"
size="small"
style={{ width: 78 }}
value={inputValue}
onChange={this.handleInputChange}

View File

@ -48,7 +48,9 @@ class App extends React.Component {
}
renderFooter = () => {
return (
<Button size="small" style={{ float: 'right', margin: 5 }}
<Button
size="small"
style={{ float: 'right', margin: 5 }}
onClick={this.getMock}
>
reload

View File

@ -85,10 +85,13 @@ class Demo extends React.Component {
return (
<Tree
checkable
onExpand={this.onExpand} expandedKeys={this.state.expandedKeys}
onExpand={this.onExpand}
expandedKeys={this.state.expandedKeys}
autoExpandParent={this.state.autoExpandParent}
onCheck={this.onCheck} checkedKeys={this.state.checkedKeys}
onSelect={this.onSelect} selectedKeys={this.state.selectedKeys}
onCheck={this.onCheck}
checkedKeys={this.state.checkedKeys}
onSelect={this.onSelect}
selectedKeys={this.state.selectedKeys}
>
{loop(gData)}
</Tree>