From 945f7e9d1ce1900deaae9f03d56412c74fff66cd Mon Sep 17 00:00:00 2001 From: June Date: Fri, 14 Nov 2025 19:14:04 +1300 Subject: [PATCH] more refactors --- web/src/components/postList/postCard.astro | 18 +++++++++++ web/src/components/postList/tagList.astro | 21 +++++++++++++ web/src/pages/posts/index.astro | 36 +++------------------- 3 files changed, 43 insertions(+), 32 deletions(-) create mode 100644 web/src/components/postList/postCard.astro create mode 100644 web/src/components/postList/tagList.astro diff --git a/web/src/components/postList/postCard.astro b/web/src/components/postList/postCard.astro new file mode 100644 index 0000000..a502e93 --- /dev/null +++ b/web/src/components/postList/postCard.astro @@ -0,0 +1,18 @@ +--- +import { getFormattedDate } from "@utils/date" +import { authPB } from "@utils/pocketbase" + +const pb = await authPB() +const { p } = Astro.props +--- + +
+ +
+ + + {p['title']} + +
+ {p['description']} +
\ No newline at end of file diff --git a/web/src/components/postList/tagList.astro b/web/src/components/postList/tagList.astro new file mode 100644 index 0000000..8ae1d41 --- /dev/null +++ b/web/src/components/postList/tagList.astro @@ -0,0 +1,21 @@ +--- +const { tags } = Astro.props +--- + +

Tags

+{ + tags.length && ( + + ) +} \ No newline at end of file diff --git a/web/src/pages/posts/index.astro b/web/src/pages/posts/index.astro index c5e5828..6a603bb 100644 --- a/web/src/pages/posts/index.astro +++ b/web/src/pages/posts/index.astro @@ -1,7 +1,8 @@ --- import Base from "src/layout/Base.astro"; +import TagList from "@components/postList/tagList"; +import PostCard from "@components/postList/postCard"; import { authPB } from "src/utils/pocketbase"; -import { getFormattedDate } from '@utils/date' export const prerender = false @@ -20,39 +21,10 @@ const uniqueTags = tags.filter((v, i, a) => a.indexOf(v) === i)
A few thoughts I've had, whenever I feel like it as you can see! -

Tags

- { - uniqueTags.length && ( - - ) - } +
- { - posts.map(p => ( -
- -
- - - {p['title']} - -
- {p['description']} -
- )) - } + { posts.map(p => ) }
\ No newline at end of file