mirror of
https://github.com/status-im/react-native.git
synced 2025-01-10 01:25:39 +00:00
1d101f4236
Summary: Documentation references to source code on GitHub should point to their respective versions in order to avoid confusion and prevent broken links when the master branch differs from the currently viewed version. [More details](https://github.com/facebook/react-native/issues/7428) Originally links pointed to a hardcoded master branch on GitHub. The change augments the GitHub url to point to a respective branch of the code. The new urls are as follows: next: `https://github.com/facebook/react-native/blob/master/<path>` stable: `https://github.com/facebook/react-native/blob/0.25-stable/<path>` The website module currently does not have a unit test setup. As a result, I performed the following tests: 1. Start the server with `RN_VERSION=next` and verified all links point to _master_ <img width="945" alt="screen shot 2016-05-07 at 14 10 58" src="https://cloud.githubusercontent.com/assets/1419286/15092307/ee66fb32-145d-11e6-92a0-d03169e517c2.png"> 2. Start the server Closes https://github.com/facebook/react-native/pull/7434 Differential Revision: D3274000 Pulled By: vjeux fb-gh-sync-id: 70d766984d6b0835f0a18928d6831fd2c82b6c7b fbshipit-source-id: 70d766984d6b0835f0a18928d6831fd2c82b6c7b
59 lines
1.8 KiB
JavaScript
59 lines
1.8 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 DocsSidebar = require('DocsSidebar');
|
|
var HeaderWithGithub = require('HeaderWithGithub');
|
|
var Marked = require('Marked');
|
|
var React = require('React');
|
|
var Site = require('Site');
|
|
var Metadata = require('Metadata');
|
|
|
|
var DocsLayout = React.createClass({
|
|
childContextTypes: {
|
|
permalink: React.PropTypes.string,
|
|
version: React.PropTypes.string
|
|
},
|
|
|
|
getChildContext: function() {
|
|
return {
|
|
permalink: this.props.metadata.permalink,
|
|
version: Metadata.config.RN_VERSION || 'next'
|
|
};
|
|
},
|
|
|
|
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" />
|
|
<HeaderWithGithub
|
|
title={metadata.title}
|
|
level={1}
|
|
path={'docs/' + metadata.filename}
|
|
/>
|
|
<Marked>{content}</Marked>
|
|
<div className="docs-prevnext">
|
|
{metadata.previous && <a className="docs-prev" href={'docs/' + metadata.previous + '.html#content'}>← Prev</a>}
|
|
{metadata.next && <a className="docs-next" href={'docs/' + metadata.next + '.html#content'}>Next →</a>}
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</Site>
|
|
);
|
|
}
|
|
});
|
|
|
|
module.exports = DocsLayout;
|