react-native/website/layout/DocsLayout.js
Christopher Chedeau 847220957a Add "Edit on GitHub" link on normal docs pages
Summary:
<img width="938" alt="screen shot 2016-01-20 at 10 38 23 pm" src="https://cloud.githubusercontent.com/assets/197597/12473376/8f0ac970-bfc6-11e5-9e44-0481e9f250f1.png">
Closes https://github.com/facebook/react-native/pull/5454

Reviewed By: svcscm

Differential Revision: D2849235

Pulled By: vjeux

fb-gh-sync-id: 0103f3d5249b1dfc03aa77feb9ae3bb7bbe9c746
2016-01-20 23:47:33 -08:00

47 lines
1.5 KiB
JavaScript

/**
* 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.
*
* @providesModule DocsLayout
*/
var React = require('React');
var Site = require('Site');
var Marked = require('Marked');
var DocsSidebar = require('DocsSidebar');
var DocsLayout = React.createClass({
render: function() {
var metadata = this.props.metadata;
var content = this.props.children;
return (
<Site section="docs" title={metadata.title}>
<section className="content wrap documentationContent">
<DocsSidebar metadata={metadata} />
<div className="inner-content">
<a id="content" />
<h1>
{metadata.title}
<a
className="edit-github"
href={'https://github.com/facebook/react-native/blob/master/docs/' + metadata.filename}>
Edit on GitHub
</a>
</h1>
<Marked>{content}</Marked>
<div className="docs-prevnext">
{metadata.previous && <a className="docs-prev" href={metadata.previous + '.html#content'}>&larr; Prev</a>}
{metadata.next && <a className="docs-next" href={metadata.next + '.html#content'}>Next &rarr;</a>}
</div>
</div>
</section>
</Site>
);
}
});
module.exports = DocsLayout;