homepage/src/components/nav.js

51 lines
1.5 KiB
JavaScript
Raw Normal View History

2020-07-29 01:12:36 +00:00
import React from 'react'
import navStyles from './nav.module.css'
import { Link } from 'gatsby'
2019-12-11 21:34:32 +00:00
let pages = [
2020-07-29 01:12:36 +00:00
['home', '/', navStyles.desktopOnly],
['zeiten & location', '/treff', ''],
['events', '/events', ''],
['über uns', '/about', ''],
['kontakt', '/kontakt', ''],
['verein', '/verein', ''],
['supporte uns', '/support', ''],
2019-12-11 21:34:32 +00:00
]
export default ({ path }) => {
// nav items should always be active in the staticly generated html
2020-07-29 01:12:36 +00:00
const isSSR = typeof window === 'undefined'
const activeClasses = link =>
2020-07-29 01:12:36 +00:00
isSSR && path === link ? ' ' + navStyles.navItemActive : ''
return (
<>
2020-01-23 21:06:44 +00:00
<header className={navStyles.header}>
<Link to="/">
<div className={navStyles.headerContent}>
2020-01-28 21:51:14 +00:00
{/* todo: fix image links in prod by using the gatsby component */}
<img alt="CTDO-Logo" width="80rem" src="/logo_ctdo.svg" />
<span>
<span className={navStyles.chaos}>Chaostreff</span> Dortmund
</span>
</div>
</Link>
2020-01-23 21:06:44 +00:00
</header>
<nav className={navStyles.nav}>
<div className={navStyles.navContent}>
{pages.map(([title, link, device]) => (
<Link
key={title}
2020-07-29 01:12:36 +00:00
className={navStyles.navItem + activeClasses(link) + ' ' + device}
activeClassName={navStyles.navItemActive}
2020-07-29 01:12:36 +00:00
to={`${link}`}
>
{title}
</Link>
))}
</div>
2020-01-23 21:06:44 +00:00
</nav>
</>
)
}