blob: 3d73dbae4a315f490098e1199c6fba1de669cec6 (
plain)
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
|
import React from 'react'
import { css } from '@emotion/core'
import { Link } from 'gatsby'
import { margins } from './globals'
const navStyle = css`
display: flex;
align-items: center;
// TODO find a better way to handle
// "collapse" of padding when flex "wrapping"
margin: 0 0 0 -${margins.md}px;
`
export const Nav = p => {
const linkStyle = css`
padding: 0 ${margins.md}px ${margins.md}px ${margins.md}px;
&:not(:last-child) {
margin: 0 ${margins.sm}px 0 0;
}
text-decoration: none;
border: ${p.hoverBorder};
border-color: rgba(0, 0, 0, 0);
&:hover {
border-color: initial;
}
`
return (
<nav css={navStyle}>
{p.links
? p.links.map(({ name, link }) => (
<Link
css={linkStyle}
to={link}
key={link}
activeStyle={{ borderColor: 'initial' }}
>
{name}
</Link>
))
: null}
</nav>
)
}
|