@@ -3,47 +3,20 @@ import { getCollection } from "astro:content";
33import ProjectList from " +/components/ProjectList.astro" ;
44import GlobalLayout from " +/layouts/GlobalLayout.astro" ;
55import { Focus } from " +/schema" ;
6+ import { kinds } from " +contents/project-kinds.ts" ;
67
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 ) {
8+ export function getStaticPaths() {
289 return kinds .map ((kind ) => ({
2910 params: { kind: kind .path },
3011 props: { kind },
3112 }));
3213}
3314
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- }
15+ const kind = Astro .props .kind ;
4316
4417const projects = (await getCollection (" projects" ))
4518 .filter ((project ) => {
46- return project .data .kind === Astro . props . kind ;
19+ return project .data .kind === kind . frontmatter ;
4720 })
4821 .sort ((a , b ) => {
4922 const a_order = a .data .order ?? Number .POSITIVE_INFINITY;
@@ -62,26 +35,40 @@ const projects = (await getCollection("projects"))
6235 image ={ null }
6336>
6437 <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- >
38+ <h1 class =" text-center text-4xl" >{ kind .title } </h1 >
39+ <div role =" tablist" class =" tabs tabs-lift" >
40+ {
41+ kinds .map ((tab ) => (
42+ <a >
43+ <a
44+ role = " tab"
45+ class :list = { [
46+ " tab" ,
47+ { " tab-active" : kind .frontmatter === tab .frontmatter },
48+ ]}
49+ href = { tab .path ? ` /projects/${tab .path } ` : " /projects" }
50+ >
51+ { tab .tabTitle }
52+ </a >
53+ </a >
54+ ))
55+ }
8456 </div >
85- <ProjectList {projects } class =" mt-16" variant =" full" />
57+ {
58+ projects .length === 0 ? (
59+ <p class = " mt-30 text-center text-gray-500" >
60+ プロジェクトはまだありません。
61+ </p >
62+ ) : (
63+ <ProjectList { projects } class = " mt-16" variant = " full" />
64+ )
65+ }
66+ {
67+ projects .length < 10 && (
68+ <p class = " mt-30 text-center text-gray-500" >
69+ このページは準備中です。ほとんどのプロジェクトは反映されていません。
70+ </p >
71+ )
72+ }
8673 </main >
8774</GlobalLayout >
0 commit comments