Skip to content

Commit 1e76d58

Browse files
committed
mostly complete
1 parent 03f411e commit 1e76d58

File tree

26 files changed

+530
-262
lines changed

26 files changed

+530
-262
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ bun install --frozen-lockfile
2222

2323
style more
2424
a11y <https://astro.build/integrations/2/?search=&categories%5B%5D=performance%2Bseo&categories%5B%5D=accessibility>
25-
pagination https://code.vool.jp/blog/astro-pagination/
25+
pagination
26+
27+
- https://code.vool.jp/blog/astro-pagination/
28+
- https://docs.astro.build/en/guides/routing/#pagination
2629

2730
## 開発
2831

bun.lock

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contents/articles/2025-02-20_2025-spring-camp/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
title: 2025 年度春合宿を開催しました
3-
date: 2025-03-01T20:00:00+09:00
3+
date: 2025-03-01
44
image: ./image.jpg
55
slug: 2025-spring-camp
6-
author: tyasumura
6+
author: "tyasumura"
77
---
88

99
ut.code(); では 2 月 20 日から 22 日まで、東京大学山中寮内藤セミナーハウスにて春合宿を実施しました。

contents/banner.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
type Banner = {
2+
shown: boolean;
3+
kind: "notify" | "error";
4+
long: string;
5+
short: string;
6+
link: string;
7+
linkText?: string;
8+
};
9+
const banner: Banner = {
10+
shown: true,
11+
kind: "error",
12+
long: "開発中の Website V3 を見ています",
13+
short: "ハッカソンを開催します",
14+
link: "https://utcode.net",
15+
linkText: "リリース版に戻る",
16+
};
17+
18+
export default banner;

contents/members/kshibayama/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ description: サークルいっぱい入ってる多趣味な人。
77
faceImage: ./face.jpg
88
upperBodyImage: ./upper-body.jpg
99
github: Tsurubara-UTcode
10+
theme-light: "#CEDDF2"
1011
---
1112

1213
## 自己紹介

contents/members/ykobayashi/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ date: 2023-04-03
77
description: Helix と NixOS を使います。
88
faceImage: ./face.jpg
99
upperBodyImage: ./upper-body.jpg
10+
theme-light: "#FEFCE8"
1011
---
1112

1213
## 自己紹介

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@
2424
"@iconify-json/feather": "^1.2.1",
2525
"@mdx-js/react": "^3.1.0",
2626
"@tailwindcss/typography": "^0.5.16",
27+
"@types/html-to-text": "^9.0.4",
2728
"astro": "^5.4.2",
2829
"astro-icon": "^1.1.5",
2930
"color": "^5.0.0",
3031
"date-fns": "^4.1.0",
32+
"markdown-to-txt": "^2.0.1",
3133
"nullthrows": "^1.1.1",
3234
"prismjs": "^1.29.0",
3335
"react": "^19.0.0",

src/components/ActionButton.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const { to, variant = "dark" } = props;
1515
href={to}
1616
{...!to.startsWith("/") ? { target: "_blank", rel: "noreferrer" } : {}}
1717
class:list={[
18-
"not-prose relative flex w-max items-center gap-4 rounded-full bg-white px-6 py-3 font-bold text-black hover:brightness-95 active:top-0.75",
18+
"not-prose relative flex w-max items-center gap-4 rounded-full bg-white px-6 py-3 font-bold text-black hover:brightness-95 active:top-0.25",
1919
variant === "dark" && "border border-black",
2020
!props["no-motion"] && "motion",
2121
Astro.props.class,

src/components/ArticleList.astro

Lines changed: 56 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,102 @@
11
---
22
import { format } from "date-fns";
3-
import noImage from "../images/no-image.svg";
4-
import type { Article } from "../schema";
53
import { Image } from "astro:assets";
4+
import { getCollection } from "astro:content";
5+
import { markdownToTxt } from "markdown-to-txt";
66
77
interface Props {
8-
variant?: "normal" | "compact";
9-
articles: { data: Article; body?: string }[];
8+
variant?: "full" | "compact";
109
class?: string;
1110
}
1211
const props = Astro.props;
13-
const { variant = "normal", articles } = props;
12+
const { variant = "full" } = props;
13+
14+
const articles = (await getCollection("articles")).sort(
15+
(a, b) => b.data.date.getTime() - a.data.date.getTime(),
16+
);
17+
if (variant === "compact") {
18+
articles.splice(3);
19+
}
20+
21+
const MDXSpecialSyntax = /^import ActionButton from ".+";/;
22+
23+
const articlesWithExcerpts = await Promise.all(
24+
articles.map(async (article) => {
25+
if (!article.body) throw new Error("article doesn't have body!");
26+
// 😇 performance
27+
const text = markdownToTxt(article.body);
28+
return {
29+
article,
30+
text: text.replace(MDXSpecialSyntax, ""),
31+
};
32+
}),
33+
);
1434
---
1535

16-
<!--
17-
fragment ArticleListArticle on Mdx {
18-
id
19-
frontmatter {
20-
date
21-
slug
22-
title
23-
image {
24-
childImageSharp {
25-
gatsbyImageData(
26-
width: 600
27-
height: 400
28-
transformOptions: { fit: INSIDE }
29-
)
30-
largeGatsbyImageData: gatsbyImageData(
31-
width: 1200
32-
height: 800
33-
transformOptions: { fit: INSIDE }
34-
)
35-
}
36-
}
37-
}
38-
excerpt(pruneLength: 60)
39-
longExcerpt: excerpt(pruneLength: 200)
40-
}
41-
-->
4236
<ul
4337
class:list={[
4438
"grid grid-flow-dense gap-9 md:grid-cols-2 lg:grid-cols-3",
45-
variant === "normal" && "xl:grid-cols-4",
39+
variant === "full" ? "variant-full xl:grid-cols-4" : "variant-compact",
4640
props.class,
4741
]}
4842
>
4943
{
50-
articles.map((article, i) => {
51-
const isFeatured = variant === "normal" && i % 11 === 0; // 11 記事ごとに大きく表示する
44+
articlesWithExcerpts.map(({ article, text }, i) => {
45+
const isFeatured = variant === "full" && i % 11 === 0; // 11 記事ごとに大きく表示する
5246
const additionalProps = isFeatured
5347
? {
5448
cellClassName: "md:col-span-2 md:row-span-2",
55-
imageClassName: "h-[350px] md:h-[450px]",
56-
excerpt: article.body?.slice(0, 120),
49+
imageClassName: "max-h-[350px] md:max-h-[450px]",
50+
excerpt: text.slice(0, 300),
5751
}
5852
: {
5953
cellClassName: "",
60-
imageClassName: "h-[200px]",
61-
excerpt: article.body?.slice(0, 120),
54+
imageClassName: "max-h-[200px]",
55+
excerpt: text.slice(0, 80),
6256
};
6357
return (
6458
<li class="contents">
6559
<a
66-
href={`/articles/${article.data.slug}`}
60+
href={`/articles/${article.id}`}
6761
class:list={[
68-
"block hover:opacity-80",
62+
"relative rounded-xl p-1 shadow-md hover:brightness-110 active:top-0.5",
6963
additionalProps.cellClassName,
7064
]}
7165
>
72-
<div
66+
<Image
67+
loading={i < 5 ? "eager" : "lazy"}
68+
alt="カバー画像"
69+
height={48 * 4 * 4}
70+
width={48 * 4 * 4}
71+
src={article.data.image}
7372
class:list={[
74-
"isolate h-48 w-full overflow-clip rounded-xl object-cover",
73+
"animate-move w-full rounded-xl object-contain object-top",
7574
additionalProps.imageClassName,
7675
]}
77-
>
78-
<Image
79-
alt="カバー画像"
80-
height={48 * 4 * 4}
81-
width={48 * 4 * 4}
82-
src={article.data.image}
83-
class="h-full w-full object-cover"
84-
/>
85-
</div>
76+
/>
8677
<div class="mt-4">
8778
<time class="block text-sm text-gray-500">
8879
{format(article.data.date, "yyyy/MM/dd HH:mm")}
8980
</time>
9081
<h3 class="text-lg font-bold">{article.data.title}</h3>
91-
<p class="prose mt-2 max-w-none">{additionalProps.excerpt}</p>
82+
<p class="prose mt-2 max-w-none">{additionalProps.excerpt}...</p>
9283
</div>
9384
</a>
9485
</li>
9586
);
9687
})
9788
}
9889
</ul>
90+
<style>
91+
@import "tailwindcss";
92+
@media (max-width: 64rem) {
93+
.variant-compact :nth-child(n + 3) a {
94+
@apply hidden;
95+
}
96+
}
97+
@media (max-width: 80rem) {
98+
.variant-compact :nth-child(n + 4) a {
99+
@apply hidden;
100+
}
101+
}
102+
</style>

src/components/Footer.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const props = Astro.props;
1212
<footer
1313
class:list={["mt-auto mb-0 w-full bg-black text-gray-200", props.class]}
1414
>
15-
<div class="container mx-auto px-8 py-12">
15+
<div class="relative bottom-0 mx-auto px-8 py-12">
1616
<div
1717
class="grid gap-x-16 gap-y-8 md:grid-cols-2 md:grid-rows-2 lg:grid-cols-3 lg:grid-rows-1"
1818
>

0 commit comments

Comments
 (0)