From e8f88106c4370d9644fc022fe286e27a8d7ffe85 Mon Sep 17 00:00:00 2001 From: Noah Swerhun Date: Tue, 2 Apr 2024 16:28:45 -0500 Subject: [PATCH] fixed state persistence, simplified header --- astro.config.mjs | 8 ++++-- src/components/Footer.astro | 12 +++++++++ src/components/Nav.tsx | 52 ++++++++++++++++++------------------- src/layouts/Layout.astro | 12 ++++++--- 4 files changed, 53 insertions(+), 31 deletions(-) create mode 100644 src/components/Footer.astro diff --git a/astro.config.mjs b/astro.config.mjs index cdf7653..57defeb 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -5,5 +5,9 @@ import solidJs from "@astrojs/solid-js"; // https://astro.build/config export default defineConfig({ - integrations: [tailwind(), solidJs()] -}); \ No newline at end of file + integrations: [tailwind(), solidJs()], + prefetch: { + prefetchAll: true, + defaultStrategy: "viewport", + } +}); diff --git a/src/components/Footer.astro b/src/components/Footer.astro new file mode 100644 index 0000000..aac6db6 --- /dev/null +++ b/src/components/Footer.astro @@ -0,0 +1,12 @@ +--- + +--- + +
+
+ Copyright (C) {new Date().getFullYear().toString()} James Hunter Deloche. +
+ + + +
diff --git a/src/components/Nav.tsx b/src/components/Nav.tsx index 32ef6cb..fc947f1 100644 --- a/src/components/Nav.tsx +++ b/src/components/Nav.tsx @@ -16,34 +16,34 @@ const activeClasses = "font-bold !text-foreground"; const Nav = () => { - const [page, setPage] = createSignal(""); + const [currentPage, setCurrentPage] = createSignal(); + onMount(() => { - if (page() != window.location.pathname) { - setPage(window.location.pathname); - } - }) + setCurrentPage(window.location.pathname); + }); + + return ( -
-
-

J. Hunter DeLoche.

- -
+ ); }; diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 824be11..eb5d58f 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -1,5 +1,6 @@ --- import Nav from "../components/Nav.tsx"; +import Footer from "../components/Footer.astro"; import { ViewTransitions } from "astro:transitions"; interface Props { @@ -18,7 +19,7 @@ const { title } = Astro.props; @@ -27,10 +28,15 @@ const { title } = Astro.props;
-