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 HeaderLinks
|
|
|
|
*/
|
|
|
|
|
|
|
|
var React = require('React');
|
|
|
|
|
|
|
|
var HeaderLinks = React.createClass({
|
2015-03-26 16:53:27 +00:00
|
|
|
linksInternal: [
|
2015-03-26 18:45:49 +00:00
|
|
|
{section: 'docs', href: '/react-native/docs/getting-started.html', text: 'Docs'},
|
2015-03-26 16:53:27 +00:00
|
|
|
{section: 'support', href: '/react-native/support.html', text: 'Support'},
|
2015-02-12 04:26:43 +00:00
|
|
|
],
|
2015-03-26 16:53:27 +00:00
|
|
|
linksExternal: [
|
|
|
|
{section: 'github', href: 'http://github.com/facebook/react-native', text: 'GitHub'},
|
|
|
|
{section: 'react', href: 'http://facebook.github.io/react', text: 'React'},
|
|
|
|
],
|
|
|
|
|
|
|
|
makeLinks: function(links) {
|
|
|
|
return links.map(function(link) {
|
|
|
|
return (
|
|
|
|
<li key={link.section}>
|
|
|
|
<a
|
|
|
|
href={link.href}
|
|
|
|
className={link.section === this.props.section ? 'active' : ''}>
|
|
|
|
{link.text}
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
);
|
|
|
|
}, this)
|
|
|
|
},
|
2015-02-12 04:26:43 +00:00
|
|
|
|
|
|
|
render: function() {
|
|
|
|
return (
|
2015-03-26 16:53:27 +00:00
|
|
|
<div className="nav-site-wrapper">
|
|
|
|
<ul className="nav-site nav-site-internal">
|
|
|
|
{this.makeLinks(this.linksInternal)}
|
|
|
|
</ul>
|
|
|
|
<ul className="nav-site nav-site-external">
|
|
|
|
{this.makeLinks(this.linksExternal)}
|
|
|
|
</ul>
|
|
|
|
</div>
|
2015-02-12 04:26:43 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = HeaderLinks;
|