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"
const pages = [
{ title: "Home", href: "/" },
{ title: "Blog", href: "/blog" },
{ title: "Home", to: "/" },
{ title: "Blog", to: "/blog" },
]
type LayoutProps = {
@ -45,12 +45,13 @@ const Layout = ({ pageTitle, preTitle, children }: LayoutProps) => {
</Typography>
<Box sx={{ flexGrow: 1, display: "flex", justifyContent: "end" }}>
{pages.map(({ title, href }) => (
{pages.map(({ title, to }) => (
<Button
key={href}
LinkComponent={GatsbyLink}
key={to}
color="inherit"
sx={{ my: 2, color: "white", display: "block" }}
{...{ href }}
{...{ to }}
>
{title}
</Button>