mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-30 22:39:34 +08:00
site: support demo[only]
This commit is contained in:
parent
140997b033
commit
5179ffbbe1
@ -31,14 +31,15 @@ export default class ComponentDoc extends React.Component {
|
|||||||
const { doc, location } = props;
|
const { doc, location } = props;
|
||||||
const { content, meta } = doc;
|
const { content, meta } = doc;
|
||||||
const locale = this.context.intl.locale;
|
const locale = this.context.intl.locale;
|
||||||
const demos = Object.keys(props.demos).map(key => props.demos[key])
|
const demos = Object.keys(props.demos).map(key => props.demos[key]);
|
||||||
.filter(demoData => !demoData.meta.hidden);
|
|
||||||
const expand = this.state.expandAll;
|
const expand = this.state.expandAll;
|
||||||
|
|
||||||
const isSingleCol = meta.cols === 1;
|
const isSingleCol = meta.cols === 1;
|
||||||
const leftChildren = [];
|
const leftChildren = [];
|
||||||
const rightChildren = [];
|
const rightChildren = [];
|
||||||
demos.sort((a, b) => a.meta.order - b.meta.order)
|
const showedDemo = demos.some(demo => demo.meta.only) ?
|
||||||
|
demos.filter(demo => demo.meta.only) : demos.filter(demo => !demo.meta.hidden);
|
||||||
|
showedDemo.sort((a, b) => a.meta.order - b.meta.order)
|
||||||
.forEach((demoData, index) => {
|
.forEach((demoData, index) => {
|
||||||
if (index % 2 === 0 || isSingleCol) {
|
if (index % 2 === 0 || isSingleCol) {
|
||||||
leftChildren.push(
|
leftChildren.push(
|
||||||
|
Loading…
Reference in New Issue
Block a user