This is my first time using the preact integration, so I thought that this would be how to make a layout page using it:
---
// src/layouts/Layout.astro
import Footer from "../components/Footer.astro";
import { Header } from "../components/Header";
import { RadioPlayer } from "../components/RadioPlayer";
import { RADIO_TITLE } from "../consts";
const { title } = Astro.props;
const formattedTitle = `${title} | ${RADIO_TITLE}`;
import "../styles/global.css";
---
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="generator" content={Astro.generator} />
<link rel="icon" type="image/png" href="/tutel.png" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="color-scheme" content="light dark" />
<title>{formattedTitle}</title>
</head>
<body>
<div class="min-h-screen flex flex-col">
<Header client:load />
<main class="flex-grow container mx-auto p-4">
<slot />
</main>
<Footer />
<RadioPlayer client:load />
</div>
</body>
</html>
but this would still force a reload across all pages when I click on a link in my header:
// src/components/Header.tsx
import { RADIO_TITLE } from "../consts";
export function Header() {
return (
<header class="bg-green-600 text-white p-4">
<nav class="container mx-auto flex justify-between">
<a href="/" class="text-xl font-bold hover:underline">
{RADIO_TITLE}
</a>
<div>
<a href="/community" class="mr-4">
Community
</a>
<a href="/about" class="mr-4">
About
</a>
<a href="/contact">Contact</a>
</div>
</nav>
</header>
);
}
This is especially annoying it will interrupt my radio player and force it to reload.