Skip to content

Commit 2f119bd

Browse files
committed
pure component for header
1 parent d1e819e commit 2f119bd

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

site/_core/HeaderLinks.js

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,16 @@ const links = [
1616
{ section: 'spec', text: 'Spec', href: 'http://facebook.github.io/graphql/' },
1717
];
1818

19-
var HeaderLinks = React.createClass({
20-
render: function() {
21-
return <nav>
22-
{links.map(link =>
23-
<a
24-
key={link.section}
25-
href={link.href}
26-
target={link.href.slice(0, 4) === 'http' ? '_blank' : null}
27-
rel={link.href.slice(0, 4) === 'http' ? 'noopener noreferrer' : null}
28-
className={link.section === this.props.section ? 'active' : null}>
29-
{link.text}
30-
</a>
31-
)}
32-
</nav>;
33-
}
34-
});
35-
36-
module.exports = HeaderLinks;
19+
export default ({ section }) =>
20+
<nav>
21+
{links.map(link =>
22+
<a
23+
key={link.section}
24+
href={link.href}
25+
target={link.href.slice(0, 4) === 'http' ? '_blank' : null}
26+
rel={link.href.slice(0, 4) === 'http' ? 'noopener noreferrer' : null}
27+
className={link.section === section ? 'active' : null}>
28+
{link.text}
29+
</a>
30+
)}
31+
</nav>

0 commit comments

Comments
 (0)