Skip to content

Commit e1c28fb

Browse files
committed
[wip] color projects
1 parent 41a3340 commit e1c28fb

File tree

2 files changed

+87
-29
lines changed

2 files changed

+87
-29
lines changed

src/pages/projects.astro

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

src/pages/projects/[...kind].astro

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
import { getCollection } from "astro:content";
3+
import ProjectList from "+/components/ProjectList.astro";
4+
import GlobalLayout from "+/layouts/GlobalLayout.astro";
5+
import { Focus } from "+/schema";
6+
7+
const kinds = [
8+
{
9+
path: undefined,
10+
kind: "long-term",
11+
title: "長期プロジェクト",
12+
tab: "長期プロジェクト",
13+
},
14+
{
15+
path: "hackathon",
16+
kind: "hackathon",
17+
title: "ハッカソン",
18+
tab: "ハッカソン",
19+
},
20+
{
21+
path: "festival",
22+
kind: "festival",
23+
title: "学園祭プロジェクト",
24+
tab: "学園祭",
25+
},
26+
];
27+
export function getStaticPaths(params) {
28+
return kinds.map((kind) => ({
29+
params: { kind: kind.path },
30+
props: { kind },
31+
}));
32+
}
33+
34+
const tabFocus = Astro.props.kind.kind;
35+
const titles = new Map([
36+
["long-term", "長期プロジェクト"],
37+
["festival", "学園祭プロジェクト"],
38+
["hackathon", "ハッカソン"],
39+
]);
40+
function getTitle() {
41+
return titles.get(Astro.props.kind);
42+
}
43+
44+
const projects = (await getCollection("projects"))
45+
.filter((project) => {
46+
return project.data.kind === Astro.props.kind;
47+
})
48+
.sort((a, b) => {
49+
const a_order = a.data.order ?? Number.POSITIVE_INFINITY;
50+
const b_order = b.data.order ?? Number.POSITIVE_INFINITY;
51+
if (a_order !== b_order) {
52+
return a_order - b_order;
53+
}
54+
return b.data.date.getTime() - a.data.date.getTime();
55+
});
56+
---
57+
58+
<GlobalLayout
59+
title="長期プロジェクト"
60+
description="ut.code(); で長期間にわたって開発を行っているプロジェクトです。"
61+
focus={Focus.projects}
62+
image={null}
63+
>
64+
<main class="container mx-auto px-4 py-24">
65+
<h1 class="text-center text-4xl">長期プロジェクト</h1>
66+
<div role="tablist" class="tabs">
67+
<a
68+
role="tab"
69+
class:list={["tab", { "tab-active": tabFocus === "long-term" }]}
70+
href="/projects">長期プロジェクト</a
71+
>
72+
<a
73+
role="tab"
74+
class="tab"
75+
class:list={["tab", { "tab-active": tabFocus === "festival" }]}
76+
href="/projects/festival">学園祭</a
77+
>
78+
<a
79+
role="tab"
80+
class="tab"
81+
class:list={["tab", { "tab-active": tabFocus === "hackathon" }]}
82+
href="/projects/hackathon">ハッカソン</a
83+
>
84+
</div>
85+
<ProjectList {projects} class="mt-16" variant="full" />
86+
</main>
87+
</GlobalLayout>

0 commit comments

Comments
 (0)