fix: navigation links cause reload

Fixed by using Gatsby Link components.
This commit is contained in:
Felix Schröter 2022-11-15 23:29:22 +01:00
parent 58a48098e9
commit 0f4ef7a54e
Signed by: felschr
GPG key ID: 671E39E6744C807D

View file

@ -6,8 +6,8 @@ import { Link as GatsbyLink } from "gatsby"
import { Footer } from "../atoms/Footer" import { Footer } from "../atoms/Footer"
const pages = [ const pages = [
{ title: "Home", href: "/" }, { title: "Home", to: "/" },
{ title: "Blog", href: "/blog" }, { title: "Blog", to: "/blog" },
] ]
type LayoutProps = { type LayoutProps = {
@ -45,12 +45,13 @@ const Layout = ({ pageTitle, preTitle, children }: LayoutProps) => {
</Typography> </Typography>
<Box sx={{ flexGrow: 1, display: "flex", justifyContent: "end" }}> <Box sx={{ flexGrow: 1, display: "flex", justifyContent: "end" }}>
{pages.map(({ title, href }) => ( {pages.map(({ title, to }) => (
<Button <Button
key={href} LinkComponent={GatsbyLink}
key={to}
color="inherit" color="inherit"
sx={{ my: 2, color: "white", display: "block" }} sx={{ my: 2, color: "white", display: "block" }}
{...{ href }} {...{ to }}
> >
{title} {title}
</Button> </Button>