diff --git a/bun.lock b/bun.lock index c9ce45e..4891701 100644 --- a/bun.lock +++ b/bun.lock @@ -27,6 +27,7 @@ "tw-animate-css": "^1.4.0", }, "devDependencies": { + "@tailwindcss/typography": "^0.5.20", "@types/bun": "^1.3.14", "prettier": "^3.9.6", "prettier-plugin-astro": "^0.14.1", @@ -542,6 +543,8 @@ "@tailwindcss/oxide-win32-x64-msvc": ["@tailwindcss/oxide-win32-x64-msvc@4.3.3", "", { "os": "win32", "cpu": "x64" }, "sha512-yJ0pwIVc/nYeGoV02WtsN8KYyLQv7kyI2wDnkezyJlGGjkd4QLwDGAwl47YpPJeuI0M0ObaXGSPjvWDPeTPggw=="], + "@tailwindcss/typography": ["@tailwindcss/typography@0.5.20", "", { "dependencies": { "postcss-selector-parser": "6.0.10" }, "peerDependencies": { "tailwindcss": ">=3.0.0 || >=4.0.0 || insiders" } }, "sha512-hwbzQuNUfcPvbegQFatVPl/MY/tcM9KLl963hQ5laJKPh81TEZ1+dNG9PirGvcaDBkp+BCshExAyKVPW91dozw=="], + "@tailwindcss/vite": ["@tailwindcss/vite@4.3.3", "", { "dependencies": { "@tailwindcss/node": "4.3.3", "@tailwindcss/oxide": "4.3.3", "tailwindcss": "4.3.3" }, "peerDependencies": { "vite": "^5.2.0 || ^6 || ^7 || ^8" } }, "sha512-yYU8cogLeSh/ms2jh8Fj7jaba/EWa7Ja6GoUqYZaraEuCI5YS6ms6ObZgjjedm+jm6XZjdNRWBpPP6Z86oOxcw=="], "@tybys/wasm-util": ["@tybys/wasm-util@0.10.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg=="], @@ -814,6 +817,8 @@ "css-what": ["css-what@6.2.2", "", {}, "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA=="], + "cssesc": ["cssesc@3.0.0", "", { "bin": { "cssesc": "bin/cssesc" } }, "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg=="], + "cssfilter": ["cssfilter@0.0.10", "", {}, "sha512-FAaLDaplstoRsDR8XGYH51znUN0UY7nMc6Z9/fvE8EXGwvJE9hu7W2vHwx1+bd6gCYnln9nLbzxFTrcO9YQDZw=="], "csso": ["csso@5.0.5", "", { "dependencies": { "css-tree": "~2.2.0" } }, "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ=="], @@ -1626,6 +1631,8 @@ "postcss": ["postcss@8.5.20", "", { "dependencies": { "nanoid": "^3.3.16", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-lW616l85ucIQL+FocMmL7pQFPqBmwejrCMg+iPxyImlrANNJG9NHq/RkyCZopDhd8C3LA03PHRJDjkbGu8vvug=="], + "postcss-selector-parser": ["postcss-selector-parser@6.0.10", "", { "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" } }, "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w=="], + "postcss-values-parser": ["postcss-values-parser@6.0.2", "", { "dependencies": { "color-name": "^1.1.4", "is-url-superb": "^4.0.0", "quote-unquote": "^1.0.0" }, "peerDependencies": { "postcss": "^8.2.9" } }, "sha512-YLJpK0N1brcNJrs9WatuJFtHaV9q5aAOj+S4DI5S7jgHlRfm0PIbDCAFRYMQD5SHq7Fy6xsDhyutgS0QOAs0qw=="], "precinct": ["precinct@12.2.0", "", { "dependencies": { "@dependents/detective-less": "^5.0.1", "commander": "^12.1.0", "detective-amd": "^6.0.1", "detective-cjs": "^6.0.1", "detective-es6": "^5.0.1", "detective-postcss": "^7.0.1", "detective-sass": "^6.0.1", "detective-scss": "^5.0.1", "detective-stylus": "^5.0.1", "detective-typescript": "^14.0.0", "detective-vue2": "^2.2.0", "module-definition": "^6.0.1", "node-source-walk": "^7.0.1", "postcss": "^8.5.1", "typescript": "^5.7.3" }, "bin": { "precinct": "bin/cli.js" } }, "sha512-NFBMuwIfaJ4SocE9YXPU/n4AcNSoFMVFjP72nvl3cx69j/ke61/hPOWFREVxLkFhhEGnA8ZuVfTqJBa+PK3b5w=="], diff --git a/package.json b/package.json index cd7db44..42f5bca 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "tw-animate-css": "^1.4.0" }, "devDependencies": { + "@tailwindcss/typography": "^0.5.20", "@types/bun": "^1.3.14", "prettier": "^3.9.6", "prettier-plugin-astro": "^0.14.1" diff --git a/src/components/lastfm.tsx b/src/components/lastfm.tsx index c63bbee..a47f064 100644 --- a/src/components/lastfm.tsx +++ b/src/components/lastfm.tsx @@ -1,7 +1,7 @@ -import clsx from 'clsx'; +import clsx from "clsx"; import { useEffect, useState } from "react"; -import type { TrackResponse } from '../types/lastfm.ts'; -import { actions } from 'astro:actions'; +import type { TrackResponse } from "../types/lastfm.ts"; +import { actions } from "astro:actions"; export default function LastFM() { const [track, setTrack] = useState(); @@ -9,40 +9,48 @@ export default function LastFM() { const [error, setError] = useState(null); useEffect(() => { - actions.getRecentTrack().then((data) => { - setTrack(data.data); - setLoading(false); - }).catch(err => { - setError(err.message); - setLoading(false); - }) - }, []) + actions + .getRecentTrack() + .then((data) => { + setTrack(data.data); + setLoading(false); + }) + .catch((err) => { + setError(err.message); + setLoading(false); + }); + }, []); - if (loading) return ( -
-
-
-
-
+ if (loading) + return ( +
+
+
+
+
+
-
- ) + ); if (!track) return null; if (error) return null; return ( -
+

{track.nowplaying ? "Now playing" : "Recently Played"}

- ) + ); } diff --git a/src/components/links.astro b/src/components/links.astro index d8d8f5f..dc17e32 100644 --- a/src/components/links.astro +++ b/src/components/links.astro @@ -10,9 +10,9 @@ import { Mail } from "@lucide/astro"; const { className } = Astro.props; --- -
-

Where to find me

-
+
+

Where to find me

+
- function normalizePathname(pathname: string) { - return pathname.replace(/\/$/, "") || "/"; - } + function normalizePathname(pathname: string) { + return pathname.replace(/\/$/, "") || "/"; + } - function resetMobileNav() { - const menuButton = document.getElementById("menuToggle"); - const mobileNav = document.getElementById("mobileNav"); - if (!menuButton) return; - menuButton.dataset.state = "closed"; - mobileNav?.classList.remove("absolute"); - mobileNav?.classList.add("hidden"); - } + function resetMobileNav() { + const menuButton = document.getElementById("menuToggle"); + const mobileNav = document.getElementById("mobileNav"); + if (!menuButton) return; + menuButton.dataset.state = "closed"; + mobileNav?.classList.remove("absolute"); + mobileNav?.classList.add("hidden"); + } - function updateActiveNav() { - const currentPathname = normalizePathname(window.location.pathname); + function updateActiveNav() { + const currentPathname = normalizePathname(window.location.pathname); - document.querySelectorAll("[data-nav-link]").forEach((link) => { - const href = link.getAttribute("data-nav-link"); - const isActive = href === currentPathname; + document.querySelectorAll("[data-nav-link]").forEach((link) => { + const href = link.getAttribute("data-nav-link"); + const isActive = href === currentPathname; - link.classList.toggle("hover:cursor-default", isActive); - link.classList.toggle("animated-link", !isActive); - link.setAttribute("aria-current", isActive ? "page" : "false"); - }); - } + link.classList.toggle("hover:cursor-default", isActive); + link.classList.toggle("animated-link", !isActive); + link.setAttribute("aria-current", isActive ? "page" : "false"); + }); + } - function toggleMobileNav() { - const menuButton = document.getElementById("menuToggle"); - const mobileNav = document.getElementById("mobileNav"); - if (!menuButton) return; - if (menuButton.dataset.state === "closed") { - menuButton.dataset.state = "open"; - mobileNav?.classList.remove("hidden"); - mobileNav?.classList.add("absolute"); - } else { - menuButton.dataset.state = "closed"; - mobileNav?.classList.remove("absolute"); - mobileNav?.classList.add("hidden"); - } + function toggleMobileNav() { + const menuButton = document.getElementById("menuToggle"); + const mobileNav = document.getElementById("mobileNav"); + if (!menuButton) return; + if (menuButton.dataset.state === "closed") { + menuButton.dataset.state = "open"; + mobileNav?.classList.remove("hidden"); + mobileNav?.classList.add("absolute"); + } else { + menuButton.dataset.state = "closed"; + mobileNav?.classList.remove("absolute"); + mobileNav?.classList.add("hidden"); } + } - document.addEventListener("astro:page-load", () => { - resetMobileNav(); - updateActiveNav(); - }); - - document.addEventListener("click", (event) => { - const target = event.target; - if (!(target instanceof Element)) return; - if (target.closest("#menuToggle")) { - toggleMobileNav(); - } - }); + document.addEventListener("astro:page-load", () => { + resetMobileNav(); + updateActiveNav(); + }); - if (document.readyState !== "loading") { - resetMobileNav(); - updateActiveNav(); - } else { - document.addEventListener("DOMContentLoaded", () => { - resetMobileNav(); - updateActiveNav(); - }); + document.addEventListener("click", (event) => { + const target = event.target; + if (!(target instanceof Element)) return; + if (target.closest("#menuToggle")) { + toggleMobileNav(); } + }); + + if (document.readyState !== "loading") { + resetMobileNav(); + updateActiveNav(); + } else { + document.addEventListener("DOMContentLoaded", () => { + resetMobileNav(); + updateActiveNav(); + }); + }
- { - isMobile ? ( - - ) : ( -
- -
- ) - } + { + isMobile ? ( +
+ +
+ ) : ( +
+ +
+ ) + }
diff --git a/src/content.config.ts b/src/content.config.ts new file mode 100644 index 0000000..c078624 --- /dev/null +++ b/src/content.config.ts @@ -0,0 +1,19 @@ +import { z } from "astro/zod"; +import { defineCollection } from "astro:content"; + +import { glob } from "astro/loaders"; + +const blog = defineCollection({ + loader: glob({ base: "./blog", pattern: "**/*.{md,mdx}" }), + schema: ({ image }) => + z.object({ + title: z.string(), + description: z.string(), + pubDate: z.coerce.date(), + coverImage: image().optional(), + coverImageAlt: z.string().optional(), + updatedDate: z.coerce.date().optional(), + }), +}); + +export const collections = { blog }; diff --git a/src/layouts/BlogLayout.astro b/src/layouts/BlogLayout.astro deleted file mode 100644 index 23f6fe0..0000000 --- a/src/layouts/BlogLayout.astro +++ /dev/null @@ -1,33 +0,0 @@ ---- -import CommonHead from "../components/commonHead.astro"; -import Footer from "../components/footer.astro"; -import Header from "../components/header.astro"; -import Links from "../components/links.astro"; -import Nav from "../components/nav.astro"; -import "../styles/global.css"; - -const { title } = Astro.props; ---- - - - - -
-
-
-
- -
-
-
-
-
-
-
-
- - diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 4d8a7bf..ca4f990 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -1,5 +1,5 @@ --- -import "@/styles/starwind.css"; +// import "@/styles/starwind.css"; import "../styles/global.css"; import Header from "../components/header.astro"; import CommonHead from "../components/commonHead.astro"; @@ -12,18 +12,18 @@ const { title } = Astro.props;