fix: navigation links cause reload
Fixed by using Gatsby Link components.
This commit is contained in:
parent
58a48098e9
commit
0f4ef7a54e
1 changed files with 6 additions and 5 deletions
|
|
@ -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>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue