2016-01-31 07:01:14 +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.
|
|
|
|
*
|
|
|
|
* @providesModule HeaderWithGithub
|
|
|
|
*/
|
2016-11-21 01:49:21 +00:00
|
|
|
'use strict';
|
2016-01-31 07:01:14 +00:00
|
|
|
|
|
|
|
var H = require('Header');
|
|
|
|
var React = require('React');
|
|
|
|
|
2016-08-04 00:37:13 +00:00
|
|
|
function getGitHubPath(path) {
|
|
|
|
return 'https://github.com/facebook/react-native/blob/master/' + path;
|
2016-05-07 15:35:11 +00:00
|
|
|
}
|
|
|
|
|
2016-01-31 07:01:14 +00:00
|
|
|
var HeaderWithGithub = React.createClass({
|
2016-05-07 15:35:11 +00:00
|
|
|
|
|
|
|
contextTypes: {
|
|
|
|
version: React.PropTypes.string
|
|
|
|
},
|
|
|
|
|
2016-01-31 07:01:14 +00:00
|
|
|
render: function() {
|
|
|
|
return (
|
|
|
|
<table width="100%">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<H level={this.props.level || 3} toSlug={this.props.title}>
|
|
|
|
{this.props.title}
|
|
|
|
</H>
|
|
|
|
</td>
|
|
|
|
<td style={{textAlign: 'right'}}>
|
|
|
|
<a
|
|
|
|
target="_blank"
|
2016-08-04 00:37:13 +00:00
|
|
|
href={getGitHubPath(this.props.path)}>
|
2016-01-31 07:01:14 +00:00
|
|
|
Edit on GitHub
|
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = HeaderWithGithub;
|