mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
docs: fix code style
This commit is contained in:
parent
61d6cf14ff
commit
12a6060304
@ -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 (
|
||||
|
@ -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>
|
||||
);
|
||||
|
@ -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);
|
||||
````
|
||||
|
@ -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'}
|
||||
|
@ -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
|
||||
|
@ -40,7 +40,8 @@ ReactDOM.render(
|
||||
Dropdown
|
||||
</Dropdown.Button>
|
||||
<Dropdown.Button
|
||||
onClick={handleButtonClick} overlay={menu}
|
||||
onClick={handleButtonClick}
|
||||
overlay={menu}
|
||||
disabled
|
||||
style={{ marginLeft: 8 }}
|
||||
>
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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"
|
||||
>
|
||||
|
@ -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>
|
||||
|
@ -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} />
|
||||
|
@ -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>
|
||||
|
@ -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}
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user