2020-07-29 01:12:36 +00:00
|
|
|
import React from 'react'
|
2021-05-15 20:08:57 +00:00
|
|
|
import * as navStyles from './nav.module.css'
|
2020-07-29 01:12:36 +00:00
|
|
|
import { Link } from 'gatsby'
|
2021-05-15 20:08:57 +00:00
|
|
|
import { StaticImage } from "gatsby-plugin-image"
|
2019-12-11 21:34:32 +00:00
|
|
|
|
|
|
|
let pages = [
|
2020-07-29 01:12:36 +00:00
|
|
|
['home', '/', navStyles.desktopOnly],
|
2021-05-15 20:08:57 +00:00
|
|
|
['zeiten & location', '/treff/', ''],
|
|
|
|
['events', '/events/', ''],
|
|
|
|
['über uns', '/about/', ''],
|
|
|
|
['kontakt', '/kontakt/', ''],
|
|
|
|
['verein', '/verein/', ''],
|
|
|
|
['supporte uns', '/support/', ''],
|
2019-12-11 21:34:32 +00:00
|
|
|
]
|
|
|
|
|
2021-05-15 20:08:57 +00:00
|
|
|
export default function Nav({ path }) {
|
2020-01-23 20:28:26 +00:00
|
|
|
// nav items should always be active in the staticly generated html
|
2020-07-29 01:12:36 +00:00
|
|
|
const isSSR = typeof window === 'undefined'
|
2020-01-23 20:28:26 +00:00
|
|
|
const activeClasses = link =>
|
2020-07-29 01:12:36 +00:00
|
|
|
isSSR && path === link ? ' ' + navStyles.navItemActive : ''
|
2020-01-23 20:28:26 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2020-01-23 21:06:44 +00:00
|
|
|
<header className={navStyles.header}>
|
2020-01-28 21:30:52 +00:00
|
|
|
<Link to="/">
|
|
|
|
<div className={navStyles.headerContent}>
|
2021-05-15 20:08:57 +00:00
|
|
|
<span className={navStyles.logoContainer}>
|
|
|
|
<StaticImage
|
|
|
|
className={navStyles.logo}
|
|
|
|
src="../images/logo_ctdo.svg"
|
|
|
|
alt="CTDO-Logo"
|
|
|
|
loading="eager"
|
|
|
|
placeholder="none"
|
|
|
|
/>
|
|
|
|
</span>
|
2020-01-28 21:30:52 +00:00
|
|
|
<span>
|
|
|
|
<span className={navStyles.chaos}>Chaostreff</span> Dortmund
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</Link>
|
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}>
|
2020-01-28 21:30:52 +00:00
|
|
|
{pages.map(([title, link, device]) => (
|
2020-01-23 20:28:26 +00:00
|
|
|
<Link
|
|
|
|
key={title}
|
2020-07-29 01:12:36 +00:00
|
|
|
className={navStyles.navItem + activeClasses(link) + ' ' + device}
|
2020-01-23 20:28:26 +00:00
|
|
|
activeClassName={navStyles.navItemActive}
|
2020-07-29 01:12:36 +00:00
|
|
|
to={`${link}`}
|
2020-01-23 20:28:26 +00:00
|
|
|
>
|
|
|
|
{title}
|
|
|
|
</Link>
|
|
|
|
))}
|
|
|
|
</div>
|
2020-01-23 21:06:44 +00:00
|
|
|
</nav>
|
2020-01-23 20:28:26 +00:00
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|