2015-02-12 04:26:43 +00:00
|
|
|
/**
|
2015-03-23 17:55:49 +00:00
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*
|
2015-02-12 04:26:43 +00:00
|
|
|
* @providesModule DocsLayout
|
|
|
|
*/
|
2016-11-21 01:49:21 +00:00
|
|
|
'use strict';
|
2015-02-12 04:26:43 +00:00
|
|
|
|
2016-01-31 07:01:14 +00:00
|
|
|
var DocsSidebar = require('DocsSidebar');
|
2017-04-26 14:09:36 +00:00
|
|
|
var EjectBanner = require('EjectBanner');
|
2016-08-04 00:37:13 +00:00
|
|
|
var Footer = require('Footer');
|
2016-11-21 01:49:21 +00:00
|
|
|
var Header = require('Header');
|
2016-01-31 07:01:14 +00:00
|
|
|
var Marked = require('Marked');
|
2016-11-21 01:49:21 +00:00
|
|
|
var Metadata = require('Metadata');
|
2015-02-12 04:26:43 +00:00
|
|
|
var React = require('React');
|
2017-04-12 23:09:48 +00:00
|
|
|
var PropTypes = require('prop-types');
|
2015-02-12 04:26:43 +00:00
|
|
|
var Site = require('Site');
|
2016-01-31 07:01:14 +00:00
|
|
|
|
2017-07-25 17:12:58 +00:00
|
|
|
class DocsLayout extends React.Component {
|
|
|
|
getChildContext() {
|
2016-05-07 15:35:11 +00:00
|
|
|
return {
|
|
|
|
permalink: this.props.metadata.permalink,
|
|
|
|
version: Metadata.config.RN_VERSION || 'next'
|
|
|
|
};
|
2017-07-25 17:12:58 +00:00
|
|
|
}
|
2016-02-29 17:20:24 +00:00
|
|
|
|
2017-07-25 17:12:58 +00:00
|
|
|
render() {
|
2015-02-12 04:26:43 +00:00
|
|
|
var metadata = this.props.metadata;
|
|
|
|
var content = this.props.children;
|
|
|
|
return (
|
2016-08-30 06:08:50 +00:00
|
|
|
<Site
|
|
|
|
section="docs"
|
2016-08-30 17:56:48 +00:00
|
|
|
title={metadata.title} >
|
2015-02-12 04:26:43 +00:00
|
|
|
<section className="content wrap documentationContent">
|
|
|
|
<DocsSidebar metadata={metadata} />
|
|
|
|
<div className="inner-content">
|
|
|
|
<a id="content" />
|
2016-08-04 00:37:13 +00:00
|
|
|
<Header level={1}>{metadata.title}</Header>
|
2017-04-26 14:09:36 +00:00
|
|
|
{(metadata.banner === 'ejected') ? <EjectBanner/> : null}
|
2015-02-12 04:26:43 +00:00
|
|
|
<Marked>{content}</Marked>
|
|
|
|
<div className="docs-prevnext">
|
2017-06-27 21:10:12 +00:00
|
|
|
{metadata.previous && <a className="docs-prev btn" href={'docs/' + metadata.previous + '.html#content'}>← Previous</a>}
|
|
|
|
{metadata.next && <a className="docs-next btn" href={'docs/' + metadata.next + '.html#content'}>Continue Reading →</a>}
|
2015-02-12 04:26:43 +00:00
|
|
|
</div>
|
2016-08-04 00:37:13 +00:00
|
|
|
<Footer path={'docs/' + metadata.filename} />
|
2015-02-12 04:26:43 +00:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</Site>
|
|
|
|
);
|
|
|
|
}
|
2017-07-25 17:12:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DocsLayout.childContextTypes = {
|
|
|
|
permalink: PropTypes.string,
|
|
|
|
version: PropTypes.string
|
|
|
|
};
|
2015-02-12 04:26:43 +00:00
|
|
|
|
|
|
|
module.exports = DocsLayout;
|