Skip to content

Commit 3214921

Browse files
committed
ui: lock size of a member, feat: introduce pagination
1 parent c8b5fae commit 3214921

File tree

3 files changed

+49
-26
lines changed

3 files changed

+49
-26
lines changed

src/pages/articles.astro

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/pages/articles/[...page].astro

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
import type { GetStaticPaths } from "astro";
3+
import ArticleList from "../../components/ArticleList.astro";
4+
import GlobalLayout from "../../layouts/GlobalLayout.astro";
5+
import { Focus } from "../../schema";
6+
import { getCollection } from "astro:content";
7+
8+
export const getStaticPaths = (async ({ paginate }) => {
9+
const articles = (await getCollection("articles")).sort(
10+
(a, b) => b.data.date.getTime() - a.data.date.getTime(),
11+
);
12+
return paginate(articles, { pageSize: 18 });
13+
}) satisfies GetStaticPaths;
14+
15+
const { page } = Astro.props;
16+
---
17+
18+
<GlobalLayout
19+
title="すべての記事"
20+
description="ut.code(); からの最新情報"
21+
focus={Focus.articles}
22+
>
23+
<main class="container mx-auto px-4 py-24">
24+
<h1 class="text-center text-4xl">すべての記事</h1>
25+
<ArticleList articles={page.data} class="mt-16" />
26+
<div class="join mx-auto block w-fit pt-16 text-xl">
27+
<a
28+
href={page.url.prev}
29+
class:list={["join-item btn", !page.url.prev && "invisible"]}
30+
aria-hidden={!page.url.prev}
31+
>
32+
«
33+
</a>
34+
<span class="join-item btn">Page {page.currentPage}</span>
35+
<a
36+
href={page.url.next}
37+
class:list={["join-item btn", !page.url.next && "invisible"]}
38+
aria-hidden={!page.url.next}
39+
>
40+
»
41+
</a>
42+
</div>
43+
</main>
44+
</GlobalLayout>

src/pages/members.astro

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const members = (await getCollection("members")).sort(
2020
loading="eager"
2121
alt=""
2222
src={MembersHeader}
23-
class="fixed top-32 -z-100 max-h-[100%] w-full object-cover md:h-[100vh]"
23+
class="fixed bottom-0 -z-100 h-[100vh] object-cover"
2424
style="object-position: 75% 20%;"
2525
aria-hidden
2626
/>
@@ -30,22 +30,22 @@ const members = (await getCollection("members")).sort(
3030
メンバー
3131
</h1>
3232
<main class="mt-[100vh] border-t-2 border-gray-600 px-4 py-16 backdrop-blur">
33-
<ul class="grid w-full gap-8 px-[10%] pt-6 md:grid-cols-2 xl:grid-cols-3">
33+
<ul class="flex flex-row flex-wrap justify-center gap-8 px-[5%] pt-6">
3434
{
3535
members.map((member) => (
36-
<li class="relative">
36+
<li>
3737
<a
3838
href={`/members/${member.id}`}
3939
class="relative block w-fit drop-shadow-lg transition-colors duration-150 hover:brightness-110 active:top-0.5"
4040
data-astro-prefetch="hover"
4141
>
4242
<Picture
4343
formats={["avif", "webp"]}
44+
fit="cover"
4445
alt={`${member.data?.nameJa} の写真`}
4546
src={member.data.upperBodyImage}
46-
width="400"
47+
width="300"
4748
height="400"
48-
class="h-[400px] w-full object-cover"
4949
/>
5050
<div class="absolute bottom-0 w-full min-w-45 bg-gradient-to-b from-transparent to-black px-6 pt-12 pb-6 text-white">
5151
<h2 class="text-3xl">{member.data.nameJa}</h2>

0 commit comments

Comments
 (0)