-
{jumper}
import React from 'react';
import PropTypes from 'prop-types';
import DocumentTitle from 'react-document-title';
import { FormattedMessage } from 'react-intl';
import classNames from 'classnames';
import { Row, Col, Icon, Affix } from 'antd';
import { getChildren } from 'jsonml.js/lib/utils';
import Demo from './Demo';
import EditButton from './EditButton';
export default class ComponentDoc extends React.Component {
static contextTypes = {
intl: PropTypes.object,
}
constructor(props) {
super(props);
this.state = {
expandAll: false,
};
}
handleExpandToggle = () => {
this.setState({
expandAll: !this.state.expandAll,
});
}
render() {
const { props } = this;
const { doc, location } = props;
const { content, meta } = doc;
const { locale } = this.context.intl;
const demos = Object.keys(props.demos).map(key => props.demos[key]);
const expand = this.state.expandAll;
const isSingleCol = meta.cols === 1;
const leftChildren = [];
const rightChildren = [];
const showedDemo = demos.some(demo => demo.meta.only) ?
demos.filter(demo => demo.meta.only) : demos.filter(demo => demo.preview);
showedDemo.sort((a, b) => a.meta.order - b.meta.order)
.forEach((demoData, index) => {
const demoElem = (