From 5217bba8f939d87f28f74d78417e2849f2288558 Mon Sep 17 00:00:00 2001 From: Laker Turner Date: Mon, 24 Mar 2025 18:13:50 +0000 Subject: [PATCH] before push commit --- package.json | 1 + pnpm-lock.yaml | 3 +++ src/components/ui/Header.astro | 39 +++++++++++++-------------- src/components/ui/Notif.astro | 24 +++++++++++++++++ src/components/ui/SizeWarning.astro | 3 --- src/components/util/Head.astro | 9 ++++--- src/components/util/SizeWarning.astro | 8 ++++++ src/content/blog/now1.md | 6 +++++ src/layouts/Base.astro | 2 +- src/layouts/Note.astro | 18 ++++++------- src/lib/metadata.ts | 27 ++++++++++++------- src/pages/blog/index.astro | 1 + src/pages/index.astro | 8 +++--- src/pages/now.astro | 33 ++++++++++++++++++----- tsconfig.json | 2 +- 15 files changed, 125 insertions(+), 59 deletions(-) create mode 100644 src/components/ui/Notif.astro delete mode 100644 src/components/ui/SizeWarning.astro create mode 100644 src/components/util/SizeWarning.astro create mode 100644 src/content/blog/now1.md diff --git a/package.json b/package.json index 3d5bb43..59061ad 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "@tailwindcss/vite": "^4.0.13", "astro": "^5.4.3", "ava": "^6.2.0", + "clsx": "^2.1.1", "luxon": "^3.5.0", "tailwindcss": "^4.0.13" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9b8d661..28528e6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,6 +17,9 @@ importers: ava: specifier: ^6.2.0 version: 6.2.0(rollup@4.35.0) + clsx: + specifier: ^2.1.1 + version: 2.1.1 luxon: specifier: ^3.5.0 version: 3.5.0 diff --git a/src/components/ui/Header.astro b/src/components/ui/Header.astro index 17b3633..4f2508a 100644 --- a/src/components/ui/Header.astro +++ b/src/components/ui/Header.astro @@ -1,34 +1,31 @@ --- import Navigation from "./Navigation.astro"; import conf from "~/site.config"; +import { isBlog } from "~/lib/metadata"; let headertext = conf.siteName; let headerurl = "/"; let headerarrow = false; -function isBlog() { - return Astro.url.pathname.startsWith("/blog"); -} - -if (isBlog()) { - headertext = "Everything And The Girl"; - headerurl = "/blog"; - headerarrow = true; +if (isBlog(Astro.url.pathname)) { + headertext = "Everything And The Girl"; + headerurl = "/blog"; + headerarrow = true; } ---
-

- { - headerarrow && ( - - - - - - ) - } - {headertext} -

- +

+ { + headerarrow && ( + + + + + + ) + } + {headertext} +

+
diff --git a/src/components/ui/Notif.astro b/src/components/ui/Notif.astro new file mode 100644 index 0000000..fe3485d --- /dev/null +++ b/src/components/ui/Notif.astro @@ -0,0 +1,24 @@ +--- +import { clsx } from "clsx"; + +interface Props { + level: number; + icon?: string; +} + +// level 0: info/note +// level 1: warning +// level 2: attn needed: oh fuck + +const { level } = Astro.props; +--- + +
+ +
diff --git a/src/components/ui/SizeWarning.astro b/src/components/ui/SizeWarning.astro deleted file mode 100644 index e322028..0000000 --- a/src/components/ui/SizeWarning.astro +++ /dev/null @@ -1,3 +0,0 @@ -
-

This view port may be too small.

Try ivyneeds.rest on a bigger screen.

-
diff --git a/src/components/util/Head.astro b/src/components/util/Head.astro index 78d144f..c1019e9 100644 --- a/src/components/util/Head.astro +++ b/src/components/util/Head.astro @@ -9,12 +9,15 @@ const { title, description } = Astro.props; - {titleConstructor(title)} + {titleConstructor(title, Astro.url.pathname)} {/* og */} - + @@ -37,5 +40,5 @@ const { title, description } = Astro.props; {/* clacks */} - + diff --git a/src/components/util/SizeWarning.astro b/src/components/util/SizeWarning.astro new file mode 100644 index 0000000..5e7c27f --- /dev/null +++ b/src/components/util/SizeWarning.astro @@ -0,0 +1,8 @@ +--- +import Notif from "../ui/Notif.astro"; +--- + + +

This view port may be too small.

+

Try ivyneeds.rest on a bigger screen.

+
diff --git a/src/content/blog/now1.md b/src/content/blog/now1.md new file mode 100644 index 0000000..ea831e0 --- /dev/null +++ b/src/content/blog/now1.md @@ -0,0 +1,6 @@ +--- +title: "/now: 2025-W13" +description: "its now" +date: 2025-03-24 +tags: now +--- \ No newline at end of file diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro index e8d8328..6022de8 100644 --- a/src/layouts/Base.astro +++ b/src/layouts/Base.astro @@ -2,7 +2,7 @@ import "~/styles/global.css"; import Head from "~/components/util/Head.astro"; import { ClientRouter } from "astro:transitions"; -import SizeWarning from "~/components/ui/SizeWarning.astro"; +import SizeWarning from "~/components/util/SizeWarning.astro"; const { title, date, description } = Astro.props; --- diff --git a/src/layouts/Note.astro b/src/layouts/Note.astro index 4cf5394..d096cee 100644 --- a/src/layouts/Note.astro +++ b/src/layouts/Note.astro @@ -3,21 +3,17 @@ import Base from "~/layouts/Base.astro"; import Header from "~/components/ui/Header.astro"; import Date from "~/components/util/Date.astro"; import { noteTitleConstructor } from "~/lib/metadata"; +import StyledLink from "~/components/util/StyledLink.astro"; const { title, exturl, icon, date } = Astro.props; ---
- +

A note from

-
+
    { title && ( @@ -42,4 +38,8 @@ const { title, exturl, icon, date } = Astro.props;
+
+ + See more notes + diff --git a/src/lib/metadata.ts b/src/lib/metadata.ts index ed9d1eb..efa3639 100644 --- a/src/lib/metadata.ts +++ b/src/lib/metadata.ts @@ -1,18 +1,25 @@ import conf from "~/site.config"; -// todo: add blog detection -export const titleConstructor = (title: string) => { - console.log(title) - if (!title) return conf.siteName; - return `${title} | ${conf.siteName}`; +export const isBlog = (pathname: string) => { + return pathname.startsWith("/blog"); +}; + +export const titleConstructor = (title: string, pathname: string) => { + if (isBlog(pathname)) { + return title + ? `${title} | Everything And The Girl` + : "Everything And The Girl"; + } + if (!title) return conf.siteName; + return `${title} | ${conf.siteName}`; }; export const descriptionConstructor = (description: string) => { - if (!description) return conf.description; - return `${description}`; + if (!description) return conf.description; + return `${description}`; }; export const noteTitleConstructor = (title: string, date: Date) => { - if (title) return title; - return `A note from ${date.toLocaleDateString()}`; -}; \ No newline at end of file + if (title) return title; + return `A note from ${date.toLocaleDateString()}`; +}; diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index 2f07fb6..3984fc0 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -8,5 +8,6 @@ import BlogPostList from "~/components/lists/BlogPostList.astro"; description="A list of all my blog posts." icon="fa-solid fa-blog" > + diff --git a/src/pages/index.astro b/src/pages/index.astro index 623e9c0..0f0d3ab 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -8,7 +8,6 @@ import NoteList from "~/components/lists/NoteList.astro"; import StyledLink from "~/components/util/StyledLink.astro"; import { Content as Bio } from "~/content/bio.md"; import Prose from "~/components/ui/Prose.astro"; -import { getClacks } from "~/lib/fun"; --- @@ -21,13 +20,11 @@ import { getClacks } from "~/lib/fun"; Hi! I'm Ivy, welcome to my website! - {getClacks()} - -
+

@@ -40,5 +37,6 @@ import { getClacks } from "~/lib/fun";
+