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
|
|
|
|
*/
|
2016-11-21 01:49:21 +00:00
|
|
|
'use strict';
|
2015-02-12 04:26:43 +00:00
|
|
|
|
2015-12-29 17:43:40 +00:00
|
|
|
var AlgoliaDocSearch = require('AlgoliaDocSearch');
|
2016-11-21 01:49:21 +00:00
|
|
|
var React = require('React');
|
2015-02-12 04:26:43 +00:00
|
|
|
|
|
|
|
var HeaderLinks = React.createClass({
|
2015-03-26 16:53:27 +00:00
|
|
|
linksInternal: [
|
2016-05-20 09:41:21 +00:00
|
|
|
{section: 'docs', href: 'docs/getting-started.html', text: 'Docs', target: '.nav-docs'},
|
2016-09-21 23:40:49 +00:00
|
|
|
{section: 'support', href: '/react-native/support.html', text: 'Help'},
|
2016-08-25 18:02:27 +00:00
|
|
|
{section: 'blog', href: '/react-native/blog/', text: 'Blog'},
|
2015-02-12 04:26:43 +00:00
|
|
|
],
|
2015-03-26 16:53:27 +00:00
|
|
|
linksExternal: [
|
2015-05-04 05:27:33 +00:00
|
|
|
{section: 'github', href: 'https://github.com/facebook/react-native', text: 'GitHub'},
|
2015-03-26 16:53:27 +00:00
|
|
|
{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}
|
2016-05-20 09:41:21 +00:00
|
|
|
className={link.section === this.props.section ? 'active' : ''}
|
|
|
|
data-target={link.target}>
|
2015-03-26 16:53:27 +00:00
|
|
|
{link.text}
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
);
|
2016-03-14 02:37:23 +00:00
|
|
|
}, this);
|
2015-03-26 16:53:27 +00:00
|
|
|
},
|
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>
|
2015-12-29 17:43:40 +00:00
|
|
|
|
|
|
|
<AlgoliaDocSearch />
|
|
|
|
|
2015-03-26 16:53:27 +00:00
|
|
|
<ul className="nav-site nav-site-external">
|
|
|
|
{this.makeLinks(this.linksExternal)}
|
|
|
|
</ul>
|
|
|
|
</div>
|
2015-02-12 04:26:43 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = HeaderLinks;
|