2019-12-11 21:34:32 +00:00
|
|
|
import React from "react"
|
|
|
|
import navStyles from "./nav.module.css"
|
|
|
|
import { Link } from "gatsby"
|
|
|
|
|
|
|
|
let pages = [
|
|
|
|
["home", ""],
|
2020-01-23 20:28:26 +00:00
|
|
|
["zeiten & location", "treff"],
|
|
|
|
["events", "events"],
|
|
|
|
["kontakt", "kontakt"],
|
|
|
|
["verein", "verein"],
|
2019-12-11 21:34:32 +00:00
|
|
|
]
|
|
|
|
|
2020-01-23 20:28:26 +00:00
|
|
|
export default ({ path }) => {
|
|
|
|
// nav items should always be active in the staticly generated html
|
|
|
|
const isSSR = typeof window === "undefined"
|
|
|
|
const activeClasses = link =>
|
|
|
|
isSSR && path === "/" + link ? " " + navStyles.navItemActive : ""
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2020-01-23 21:06:44 +00:00
|
|
|
<header className={navStyles.header}>
|
2020-01-23 20:28:26 +00:00
|
|
|
<div className={navStyles.headerContent}>
|
|
|
|
<span className={navStyles.chaos}>Chaostreff</span> Dortmund
|
|
|
|
</div>
|
2020-01-23 21:06:44 +00:00
|
|
|
</header>
|
|
|
|
<nav className={navStyles.nav}>
|
2020-01-23 20:28:26 +00:00
|
|
|
<div className={navStyles.navContent}>
|
|
|
|
{pages.map(([title, link]) => (
|
|
|
|
<Link
|
|
|
|
key={title}
|
|
|
|
className={navStyles.navItem + activeClasses(link)}
|
|
|
|
activeClassName={navStyles.navItemActive}
|
|
|
|
activeStyle={{ textDecoration: `solid underline white 0.2em` }}
|
|
|
|
to={`/${link}`}
|
|
|
|
>
|
|
|
|
{title}
|
|
|
|
</Link>
|
|
|
|
))}
|
|
|
|
</div>
|
2020-01-23 21:06:44 +00:00
|
|
|
</nav>
|
2020-01-23 20:28:26 +00:00
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|