-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathNavBar.js
67 lines (65 loc) · 1.37 KB
/
NavBar.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import React from 'react';
import PropTypes from 'prop-types';
import Link from 'next/link';
/**
*
*
* @export
* @class NavBar
* @augments {React.PureComponent<NavBarProps>}
*/
export default class NavBar extends React.PureComponent {
/**
* @typedef {object} NavBarProps
* @property {array} links
*
* @static
* @memberof NavBar
*/
static propTypes = {
/** Links Array */
links: PropTypes.arrayOf(
PropTypes.shape({
/** Link URL */
url: PropTypes.string,
/** Link Title */
title: PropTypes.string,
})
).isRequired,
};
render() {
return (
<React.Fragment>
<style jsx>{`
nav {
background: linear-gradient(90deg, violet, limegreen);
}
nav ul {
margin: 0;
padding: 20px;
list-style: none;
}
nav ul li {
display: inline-block;
margin: 5px;
}
nav ul li a {
color: white;
text-decoration: none;
}
`}</style>
<nav>
<ul>
{this.props.links.map(({ url, title }, i) => (
<li key={i}>
<Link href={url}>
<a>{title}</a>
</Link>
</li>
))}
</ul>
</nav>
</React.Fragment>
);
}
}