diff --git a/astro.config.mjs b/astro.config.mjs index 978c5c8..47c9659 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -17,5 +17,10 @@ export default defineConfig({ }), vite: { plugins: [], + server: { + watch: { + usePolling: true, + }, + }, }, }); diff --git a/src/assets/icon/calendar.png b/src/assets/icon/calendar.png new file mode 100644 index 0000000..d16ac5b Binary files /dev/null and b/src/assets/icon/calendar.png differ diff --git a/src/assets/icon/eye.png b/src/assets/icon/eye.png new file mode 100644 index 0000000..58f33e8 Binary files /dev/null and b/src/assets/icon/eye.png differ diff --git a/src/assets/icon/folder.png b/src/assets/icon/folder.png new file mode 100644 index 0000000..ca84780 Binary files /dev/null and b/src/assets/icon/folder.png differ diff --git a/src/components/IndexSidebar.astro b/src/components/IndexSidebar.astro new file mode 100644 index 0000000..42386ec --- /dev/null +++ b/src/components/IndexSidebar.astro @@ -0,0 +1,87 @@ +--- +import Folder from "@/assets/icon/folder.png?url"; +import type {CategoriesStats} from "@/types"; + +interface Props { + categories: CategoriesStats[] +} +const {categories} = Astro.props +--- + + + diff --git a/src/components/IndexView.astro b/src/components/IndexView.astro new file mode 100644 index 0000000..b1cb123 --- /dev/null +++ b/src/components/IndexView.astro @@ -0,0 +1,35 @@ +--- +import type {Post, CategoriesStats} from "@/types/post"; +import IndexSidebar from "@/components/IndexSidebar.astro"; +import PostList from '@/components/PostList.astro' + +interface Props { + posts: Post[] + page: number + totalPage: number + categories: CategoriesStats[] +} + +const {posts, page, totalPage, categories} = Astro.props +--- + +
+ + + +
+ + diff --git a/src/components/PostList.astro b/src/components/PostList.astro index daae167..1e901d9 100644 --- a/src/components/PostList.astro +++ b/src/components/PostList.astro @@ -1,4 +1,7 @@ --- +import Eye from "@/assets/icon/eye.png?url"; +import Folder from "@/assets/icon/folder.png?url"; +import Calendar from "@/assets/icon/calendar.png?url"; import type {Post} from "@/types/post"; import {formatDatetime} from "@/lib/format.ts"; @@ -11,155 +14,232 @@ interface Props { const {posts, page, totalPage} = Astro.props posts.map((post) => { - post.published_at = formatDatetime(post.published_at, 'YYYY 年 M 月 D 日') + post.published_at = formatDatetime(post.published_at, 'YYYY-MM-DD') }) --- - -
- { - posts.map((post) => ( - -
{post.published_at}
-
{post.category_name}
-
{post.title}
- +
+
+ {posts.map(post => ( + +
+
+ {post.title} +
+
+ +

+ {post.title} +

+
+ {post.summary} +
+ + + + + +
+
- )) - } -
+ ))} +
- -{totalPage>1&& -} + + {totalPage > 1 && + } + diff --git a/src/consts.ts b/src/consts.ts index 4744a05..00ac662 100644 --- a/src/consts.ts +++ b/src/consts.ts @@ -1,5 +1,5 @@ export const metadata = { siteTitle: "Uroboros", - postPageSize: 12 + postPageSize: 6 } diff --git a/src/pages/404.astro b/src/pages/404.astro index 5257102..73653a1 100644 --- a/src/pages/404.astro +++ b/src/pages/404.astro @@ -12,13 +12,12 @@ import Layout from "@/layouts/Layout.astro";