fix page building and linking

This commit is contained in:
neri 2020-07-29 03:12:36 +02:00
parent 23b0a146eb
commit bf71ed2077
12 changed files with 3141 additions and 2487 deletions

View File

@ -11,7 +11,7 @@ module.exports = {
resolve: `gatsby-source-filesystem`, resolve: `gatsby-source-filesystem`,
options: { options: {
name: `pages`, name: `pages`,
path: `${__dirname}/src/pages`, path: `${__dirname}/src/webpages`,
}, },
}, },
{ {

View File

@ -1,22 +1,22 @@
import React from "react" import React from 'react'
import navStyles from "./nav.module.css" import navStyles from './nav.module.css'
import { Link } from "gatsby" import { Link } from 'gatsby'
let pages = [ let pages = [
["home", "/", navStyles.desktopOnly], ['home', '/', navStyles.desktopOnly],
["zeiten & location", "treff", ""], ['zeiten & location', '/treff', ''],
["events", "events", ""], ['events', '/events', ''],
["über uns", "about", ""], ['über uns', '/about', ''],
["kontakt", "kontakt", ""], ['kontakt', '/kontakt', ''],
["verein", "verein", ""], ['verein', '/verein', ''],
["supporte uns", "support", ""], ['supporte uns', '/support', ''],
] ]
export default ({ path }) => { export default ({ path }) => {
// nav items should always be active in the staticly generated html // nav items should always be active in the staticly generated html
const isSSR = typeof window === "undefined" const isSSR = typeof window === 'undefined'
const activeClasses = link => const activeClasses = link =>
isSSR && path === "/" + link ? " " + navStyles.navItemActive : "" isSSR && path === link ? ' ' + navStyles.navItemActive : ''
return ( return (
<> <>
@ -36,9 +36,9 @@ export default ({ path }) => {
{pages.map(([title, link, device]) => ( {pages.map(([title, link, device]) => (
<Link <Link
key={title} key={title}
className={navStyles.navItem + activeClasses(link) + " " + device} className={navStyles.navItem + activeClasses(link) + ' ' + device}
activeClassName={navStyles.navItemActive} activeClassName={navStyles.navItemActive}
to={`/${link}`} to={`${link}`}
> >
{title} {title}
</Link> </Link>

5598
yarn.lock

File diff suppressed because it is too large Load Diff