-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathnav.js
57 lines (51 loc) · 1.35 KB
/
nav.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
// @flow
import React from 'react'
import repo from '../libs/repository'
type ILink = {
href: string,
key: string,
label: string
}
type RepositoryType = 'git' | 'svn'
type Repository =
| string
| {
type: RepositoryType,
url: string
}
type Props = {
homepage?: string,
repository: Repository
}
const links: ILink[] = [].map((link: ILink, i: number) => {
link.key = `nav-link-${i}`
return link
})
const Nav = ({ homepage, repository }: Props) => {
const repoUrl = repo(repository) // @TODO need to split this logic from here
return (
<nav className="nav-link">
<a href={homepage}>Home</a>
{links.map(({ key, href, label }) =>
<a href={href} key={key}>{label}</a>
)}
<a href={repoUrl}>Git</a>
<a href="#" className="more">
<svg
aria-hidden="true"
className="octicon"
height="24"
version="1.1"
viewBox="0 0 12 16"
width="18"
>
<path
fill-rule="evenodd"
d="M11.41 9H.59C0 9 0 8.59 0 8c0-.59 0-1 .59-1H11.4c.59 0 .59.41.59 1 0 .59 0 1-.59 1h.01zm0-4H.59C0 5 0 4.59 0 4c0-.59 0-1 .59-1H11.4c.59 0 .59.41.59 1 0 .59 0 1-.59 1h.01zM.59 11H11.4c.59 0 .59.41.59 1 0 .59 0 1-.59 1H.59C0 13 0 12.59 0 12c0-.59 0-1 .59-1z"
/>
</svg>
</a>
</nav>
)
}
export default Nav