improve playground.md

pull/4362/head
afc163 8 years ago
parent 1ef76b40ec
commit 7602faed65

@ -26,7 +26,7 @@ class App extends React.Component {
colCountKey: 2, colCountKey: 2,
}; };
[8, 16, 24, 32, 40, 48].forEach((value, i) => { this.gutters[i] = value; }); [8, 16, 24, 32, 40, 48].forEach((value, i) => { this.gutters[i] = value; });
[2, 3, 4, 6, 8, 12, 24].forEach((value, i) => { this.colCounts[i] = value; }); [2, 3, 4, 6, 8, 12].forEach((value, i) => { this.colCounts[i] = value; });
} }
onGutterChange = (gutterKey) => { onGutterChange = (gutterKey) => {
this.setState({ gutterKey }); this.setState({ gutterKey });
@ -38,12 +38,14 @@ class App extends React.Component {
const { gutterKey, colCountKey } = this.state; const { gutterKey, colCountKey } = this.state;
const cols = []; const cols = [];
const colCount = this.colCounts[colCountKey]; const colCount = this.colCounts[colCountKey];
let colCode = '';
for (let i = 0; i < colCount; i++) { for (let i = 0; i < colCount; i++) {
cols.push( cols.push(
<Col key={i.toString()} span={24 / colCount}> <Col key={i.toString()} span={24 / colCount}>
<div>Column</div> <div>Column</div>
</Col> </Col>
); );
colCode += ` <Col span={${24 / colCount}} />\n`;
} }
return ( return (
<div> <div>
@ -72,6 +74,7 @@ class App extends React.Component {
</div> </div>
</div> </div>
<Row gutter={this.gutters[gutterKey]}>{cols}</Row> <Row gutter={this.gutters[gutterKey]}>{cols}</Row>
<pre>{`<Row gutter={${this.gutters[gutterKey]}}>\n${colCode}</Row>`}</pre>
</div> </div>
); );
} }
@ -91,4 +94,10 @@ ReactDOM.render(<App />, mountNode);
line-height: 120px; line-height: 120px;
font-size: 13px; font-size: 13px;
} }
#components-grid-demo-playground pre {
background: #f9f9f9;
border-radius: 6px;
font-size: 13px;
padding: 8px 16px;
}
```` ````

Loading…
Cancel
Save