|
|
@ -1,5 +1,5 @@ |
|
|
|
import React from 'react'; |
|
|
|
import DocumentTitle from 'react-document-title'; |
|
|
|
import { Helmet } from 'react-helmet'; |
|
|
|
import { FormattedMessage, injectIntl } from 'react-intl'; |
|
|
|
import classNames from 'classnames'; |
|
|
|
import { Row, Col, Icon, Affix, Tooltip } from 'antd'; |
|
|
@ -106,66 +106,68 @@ class ComponentDoc extends React.Component { |
|
|
|
const articleClassName = classNames({ |
|
|
|
'show-riddle-button': showRiddleButton, |
|
|
|
}); |
|
|
|
const helmetTitle = `${subtitle || ''} ${title[locale] || title} - Ant Design`; |
|
|
|
return ( |
|
|
|
<DocumentTitle title={`${subtitle || ''} ${title[locale] || title} - Ant Design`}> |
|
|
|
<article className={articleClassName}> |
|
|
|
<Affix className="toc-affix" offsetTop={16}> |
|
|
|
<ul id="demo-toc" className="toc"> |
|
|
|
{jumper} |
|
|
|
</ul> |
|
|
|
</Affix> |
|
|
|
<section className="markdown"> |
|
|
|
<h1> |
|
|
|
{title[locale] || title} |
|
|
|
{!subtitle ? null : <span className="subtitle">{subtitle}</span>} |
|
|
|
<EditButton |
|
|
|
title={<FormattedMessage id="app.content.edit-page" />} |
|
|
|
filename={filename} |
|
|
|
/> |
|
|
|
</h1> |
|
|
|
{utils.toReactComponent( |
|
|
|
['section', { className: 'markdown' }].concat(getChildren(content)), |
|
|
|
)} |
|
|
|
<h2> |
|
|
|
<FormattedMessage id="app.component.examples" /> |
|
|
|
<Tooltip |
|
|
|
title={ |
|
|
|
<FormattedMessage |
|
|
|
id={`app.component.examples.${expandAll ? 'collapse' : 'expand'}`} |
|
|
|
/> |
|
|
|
} |
|
|
|
> |
|
|
|
<Icon |
|
|
|
type={`${expandAll ? 'appstore' : 'appstore-o'}`} |
|
|
|
className={expandTriggerClass} |
|
|
|
onClick={this.handleExpandToggle} |
|
|
|
<article className={articleClassName}> |
|
|
|
<Helmet> |
|
|
|
<title>{helmetTitle}</title> |
|
|
|
</Helmet> |
|
|
|
<Affix className="toc-affix" offsetTop={16}> |
|
|
|
<ul id="demo-toc" className="toc"> |
|
|
|
{jumper} |
|
|
|
</ul> |
|
|
|
</Affix> |
|
|
|
<section className="markdown"> |
|
|
|
<h1> |
|
|
|
{title[locale] || title} |
|
|
|
{!subtitle ? null : <span className="subtitle">{subtitle}</span>} |
|
|
|
<EditButton |
|
|
|
title={<FormattedMessage id="app.content.edit-page" />} |
|
|
|
filename={filename} |
|
|
|
/> |
|
|
|
</h1> |
|
|
|
{utils.toReactComponent( |
|
|
|
['section', { className: 'markdown' }].concat(getChildren(content)), |
|
|
|
)} |
|
|
|
<h2> |
|
|
|
<FormattedMessage id="app.component.examples" /> |
|
|
|
<Tooltip |
|
|
|
title={ |
|
|
|
<FormattedMessage |
|
|
|
id={`app.component.examples.${expandAll ? 'collapse' : 'expand'}`} |
|
|
|
/> |
|
|
|
</Tooltip> |
|
|
|
</h2> |
|
|
|
</section> |
|
|
|
<Row gutter={16}> |
|
|
|
<Col |
|
|
|
span={isSingleCol ? 24 : 12} |
|
|
|
className={isSingleCol ? 'code-boxes-col-1-1' : 'code-boxes-col-2-1'} |
|
|
|
} |
|
|
|
> |
|
|
|
{leftChildren} |
|
|
|
<Icon |
|
|
|
type={`${expandAll ? 'appstore' : 'appstore-o'}`} |
|
|
|
className={expandTriggerClass} |
|
|
|
onClick={this.handleExpandToggle} |
|
|
|
/> |
|
|
|
</Tooltip> |
|
|
|
</h2> |
|
|
|
</section> |
|
|
|
<Row gutter={16}> |
|
|
|
<Col |
|
|
|
span={isSingleCol ? 24 : 12} |
|
|
|
className={isSingleCol ? 'code-boxes-col-1-1' : 'code-boxes-col-2-1'} |
|
|
|
> |
|
|
|
{leftChildren} |
|
|
|
</Col> |
|
|
|
{isSingleCol ? null : ( |
|
|
|
<Col className="code-boxes-col-2-1" span={12}> |
|
|
|
{rightChildren} |
|
|
|
</Col> |
|
|
|
{isSingleCol ? null : ( |
|
|
|
<Col className="code-boxes-col-2-1" span={12}> |
|
|
|
{rightChildren} |
|
|
|
</Col> |
|
|
|
)} |
|
|
|
</Row> |
|
|
|
{utils.toReactComponent( |
|
|
|
[ |
|
|
|
'section', |
|
|
|
{ |
|
|
|
className: 'markdown api-container', |
|
|
|
}, |
|
|
|
].concat(getChildren(doc.api || ['placeholder'])), |
|
|
|
)} |
|
|
|
</article> |
|
|
|
</DocumentTitle> |
|
|
|
</Row> |
|
|
|
{utils.toReactComponent( |
|
|
|
[ |
|
|
|
'section', |
|
|
|
{ |
|
|
|
className: 'markdown api-container', |
|
|
|
}, |
|
|
|
].concat(getChildren(doc.api || ['placeholder'])), |
|
|
|
)} |
|
|
|
</article> |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|