diff --git a/src/categories.js b/src/categories.js new file mode 100644 index 0000000..fcbf3eb --- /dev/null +++ b/src/categories.js @@ -0,0 +1,7 @@ +export default Object.entries({ + all: { title: "All", default: true }, + linux: { title: "Linux" }, + web: { title: "Web Development" }, + bot: { title: "Discord Bot Development" }, + other: { title: "Other" } +}) diff --git a/src/components/Nav.astro b/src/components/Nav.astro index f9d0c2c..2a31b06 100644 --- a/src/components/Nav.astro +++ b/src/components/Nav.astro @@ -12,6 +12,7 @@ import styles from "../styles/Nav.module.css" Projects About Hire + Blog
{ + const posts = await getCollection("blog") + + return categories.map(([category, properties]) => ({ + params: { category: properties.default ? undefined : category }, + props: { + filteredPosts: properties.default + ? posts + : posts.filter((post) => post.data.category == category) + } + })) +} + +const { category } = Astro.params +const { filteredPosts } = Astro.props +--- + + +
+ +
+
+

Welcome to the blog!

+ +

+ Hello, and welcome to my blog. I post about Discord Bot + Development, Web Development, Linux, and other Tech-related + subjects. You can filter and search in the sidebar. +

+
+ { + filteredPosts.map((post) => ( + + + + )) + } +
+
+ + + diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro deleted file mode 100644 index 6689e1b..0000000 --- a/src/pages/blog/index.astro +++ /dev/null @@ -1,119 +0,0 @@ ---- -import Layout from "../../layouts/Layout.astro" -import BlogPost from "../../components/BlogPost.astro" -import styles from "../../styles/Blog.module.css" -import { getCollection } from "astro:content" -import Divider from "../../components/Divider.astro" - -const posts = await getCollection("blog") ---- - - -
- -
-
-

Welcome to the blog!

- -

- Hello, and welcome to my blog. I post about Discord Bot - Development, Web Development, Linux, and other Tech-related - subjects. You can filter and search in the sidebar. -

-
- { - posts.map((post) => ( - - - - )) - } -
-
-
- - diff --git a/src/styles/Blog.module.css b/src/styles/Blog.module.css index 72c4b6d..af8113d 100644 --- a/src/styles/Blog.module.css +++ b/src/styles/Blog.module.css @@ -46,21 +46,19 @@ width: 100%; } -[aria-hidden="true"], -.radios [type="radio"] { - display: none; -} - -.radios :checked + label { +.category.selected { color: var(--primary); font-weight: bold; } -label { +.category { + text-decoration: none; + color: white; font-size: 1.3rem; } -.radios { +.categories { display: flex; + gap: 0.1rem; flex-direction: column; } diff --git a/src/styles/Layout.css b/src/styles/Layout.css index 12bbefa..1234a51 100644 --- a/src/styles/Layout.css +++ b/src/styles/Layout.css @@ -52,7 +52,7 @@ main { transition: scale 0.2s; } -:is(article, section, aside):not(section *, nav *, header *):hover { +:is(article, section, aside):not(section *, nav *, header *, aside *):hover { scale: 101.5%; } diff --git a/src/styles/Nav.module.css b/src/styles/Nav.module.css index e771a09..143ec38 100644 --- a/src/styles/Nav.module.css +++ b/src/styles/Nav.module.css @@ -1,5 +1,6 @@ .nav { display: flex; + gap: 1rem; width: 100%; align-items: center; justify-content: space-between; @@ -18,7 +19,7 @@ } .nav :is(svg, img) { - height: 2rem; + width: 2rem; } .nav button {