Skip to content

Commit 0037c2d

Browse files
committed
design is perfect now
1 parent b1d5c36 commit 0037c2d

File tree

13 files changed

+98
-114
lines changed

13 files changed

+98
-114
lines changed

bun.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"@tailwindcss/typography": "^0.5.16",
1010
"astro": "^5.4.2",
1111
"astro-icon": "^1.1.5",
12+
"daisyui": "^5.0.4",
1213
"date-fns": "^4.1.0",
1314
"markdown-to-txt": "^2.0.1",
1415
"sharp": "^0.33.5",
@@ -464,6 +465,8 @@
464465

465466
"csso": ["[email protected]", "", { "dependencies": { "css-tree": "~2.2.0" } }, "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ=="],
466467

468+
"daisyui": ["[email protected]", "", {}, "sha512-9X3oX/k9hPBCslAECk8kYfvwgrz6Grs0lN7VI0/ZTM/hUfq1uFREHxCcBCCq0QROpN183N19B1hTNRWGipO2Eg=="],
469+
467470
"date-fns": ["[email protected]", "", {}, "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg=="],
468471

469472
"debug": ["[email protected]", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA=="],

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@tailwindcss/typography": "^0.5.16",
2727
"astro": "^5.4.2",
2828
"astro-icon": "^1.1.5",
29+
"daisyui": "^5.0.4",
2930
"date-fns": "^4.1.0",
3031
"markdown-to-txt": "^2.0.1",
3132
"sharp": "^0.33.5"

src/components/ArticleList.astro

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const articlesWithExcerpts = await Promise.all(
5959
<a
6060
href={`/articles/${article.id}`}
6161
class:list={[
62-
"relative rounded-xl bg-gray-50 p-1 shadow-md hover:brightness-110 active:top-0.5",
62+
"relative rounded-xl bg-gray-50 p-1 shadow-md grayscale-50 duration-300 hover:grayscale-0 active:top-0.5",
6363
additionalProps.cellClassName,
6464
]}
6565
>
@@ -68,11 +68,9 @@ const articlesWithExcerpts = await Promise.all(
6868
transition:name={`article:cover:${article.id}`}
6969
loading={i < 5 ? "eager" : "lazy"}
7070
alt="カバー画像"
71-
height={48 * 4 * 4}
72-
width={48 * 4 * 4}
7371
src={article.data.image}
7472
class:list={[
75-
"w-full rounded-xl object-center",
73+
"min-h-0 w-full rounded-xl object-center",
7674
additionalProps.imageClassName,
7775
]}
7876
/>
@@ -81,7 +79,14 @@ const articlesWithExcerpts = await Promise.all(
8179
{format(article.data.date, "yyyy/MM/dd HH:mm")}
8280
</time>
8381
<h3 class="text-lg font-bold">{article.data.title}</h3>
84-
<p class="prose mt-2 max-w-none">{additionalProps.excerpt}...</p>
82+
<p
83+
class:list={[
84+
"prose mt-2 line-clamp-3 max-w-none",
85+
isFeatured && "md:line-clamp-6",
86+
]}
87+
>
88+
{additionalProps.excerpt}...
89+
</p>
8590
</div>
8691
</a>
8792
</li>

src/components/Header.astro

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,22 @@ interface Props {
1919
const { focus } = Astro.props;
2020
---
2121

22-
<header class="fixed top-0 z-20 w-full bg-gray-50">
22+
<header class="sticky top-0 z-20 w-full bg-gray-50">
2323
<!-- <ClientRouter transition:animate={fade({ duration: 30 })} /> -->
2424
{
2525
banner.shown && (
2626
<div
2727
id="banner"
2828
class:list={[
29-
"flex h-10 items-center justify-center gap-4 px-1 md:h-8",
29+
"flex items-center justify-center gap-4 px-1 py-2",
3030
banner.kind === "error" ? "bg-red-300" : "bg-green-300",
3131
]}
3232
>
3333
<span class="hidden md:inline">{banner.long}</span>
34-
<span aria-hidden class="inline md:hidden">
34+
<span
35+
aria-hidden
36+
class="sm:text-md inline text-center text-sm md:hidden"
37+
>
3538
{banner.short}
3639
</span>
3740
<a
@@ -49,10 +52,10 @@ const { focus } = Astro.props;
4952
}
5053
<div class="flex h-16">
5154
<a href="/" class="flex items-center px-4" data-astro-prefetch="viewport">
52-
<Logo class="ml-8 w-36" variant="default" />
55+
<Logo class="w-36 sm:ml-8" variant="default" />
5356
</a>
54-
<div aria-hidden="true" class="flex-grow"></div>
55-
<ul class="hidden md:flex">
57+
<div aria-hidden class="flex-1"></div>
58+
<ul class="hidden lg:flex">
5659
{
5760
links.map((link) => (
5861
<li>
@@ -71,7 +74,7 @@ const { focus } = Astro.props;
7174
</ul>
7275
<button
7376
type="button"
74-
class="flex h-full w-16 items-center justify-center hover:bg-gray-100 md:hidden"
77+
class="flex h-full w-16 items-center justify-center hover:bg-gray-100 lg:hidden"
7578
popovertarget="navigation-panel"
7679
popovertargetaction="toggle"
7780
>
@@ -81,9 +84,9 @@ const { focus } = Astro.props;
8184
<div
8285
id="navigation-panel"
8386
popover
84-
class="top-0 w-full transition-opacity duration-300 md:hidden"
87+
class="absolute inset-auto top-0 w-full transition-opacity duration-300 lg:hidden"
8588
>
86-
<ul class="">
89+
<ul>
8790
{
8891
links.map((link) => (
8992
<li class="hover:brightness-75">
@@ -107,6 +110,7 @@ const { focus } = Astro.props;
107110
position: fixed;
108111
}
109112
/* https://stackoverflow.com/questions/77042256/css-transition-animation-not-working-for-popover-attribute */
113+
/* https://developer.mozilla.org/en-US/docs/Web/API/Popover_API/Using#animating_popovers */
110114
[popover] {
111115
opacity: 0;
112116
&:popover-open {
@@ -115,9 +119,7 @@ const { focus } = Astro.props;
115119
opacity: 0;
116120
}
117121
}
118-
transition:
119-
opacity 0.3s,
120-
display 0.3s;
122+
transition: opacity 0.3s;
121123
transition-behavior: allow-discrete;
122124
}
123125

src/components/LazyImage.astro

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,22 @@
11
---
2-
import { getImage, Picture } from "astro:assets";
2+
import { Picture } from "astro:assets";
33
interface Props {
4-
size: "fullscreen" | "heading" | "small";
4+
size?: "fullscreen" | "heading" | "small";
55
src: ImageMetadata;
66
alt: string;
7-
width: number | `${number}`;
8-
height: number | `${number}`;
7+
width?: number | `${number}`;
8+
height?: number | `${number}`;
99
loading?: "eager" | "lazy";
1010
class?: string;
1111
"class:list"?: string[];
1212
style?: string;
13+
layout?: "responsive" | "fixed";
1314
}
1415
1516
const props = Astro.props;
16-
17-
const size = { width: 5, height: 5 };
18-
// props.size === "fullscreen"
19-
// ? {
20-
// width: 192,
21-
// height: 108,
22-
// }
23-
// : props.size === "heading"
24-
// ? {
25-
// width: 50,
26-
// height: 50,
27-
// }
28-
// : props.size === "small"
29-
// ? {
30-
// width: 20,
31-
// height: 20,
32-
// }
33-
// : (props.size satisfies never);
34-
35-
const small = await getImage({
36-
src: props.src,
37-
format: "webp",
38-
...size,
39-
});
40-
console.log(small.src);
4117
---
4218

43-
<div
44-
class="object-cover object-center"
45-
class={props.class}
46-
class:list={props["class:list"] ?? []}
47-
style={`background-size: cover; background-image: url(${small.src});` +
48-
props.style}
49-
>
19+
<div class="skeleton">
5020
<Picture
5121
loading={props.loading || "lazy"}
5222
{...props}

src/components/ProjectList.astro

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if (variant === "compact") {
2828
<li
2929
class:list={[
3030
"contents",
31-
variant === "compact" ? "variant-short" : "variant-index",
31+
variant === "compact" ? "variant-short" : "variant-full",
3232
]}
3333
>
3434
<a
@@ -39,11 +39,9 @@ if (variant === "compact") {
3939
size="small"
4040
transition:name={`project:image:${project.id}`}
4141
loading={i < 6 ? "eager" : "lazy"}
42-
width="800"
43-
height="600"
4442
alt="プロジェクトのイメージ画像"
4543
src={project.data.image}
46-
class="max-h-[24rem] w-full object-fill"
44+
class="max-h-[24rem] w-full object-contain"
4745
/>
4846
<div class="p-4">
4947
<h3 class="text-xl font-bold text-gray-800">

src/content/banner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const banner: Banner = {
1010
shown: true,
1111
kind: "error",
1212
long: "開発中の Website V3 を見ています",
13-
short: "ハッカソンを開催します",
13+
short: "開発中の Website です",
1414
link: "https://utcode.net",
1515
linkText: "リリース版に戻る",
1616
};

src/global.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@import "tailwindcss";
22
@plugin "@tailwindcss/typography";
3+
@plugin "daisyui";
34

45
/* do we need this? */
56
:root {

src/layouts/GlobalLayout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface Props {
1313
const { title, description, focus } = Astro.props;
1414
---
1515

16-
<html lang="ja" class="bg-gray-50 text-gray-800">
16+
<html lang="ja" class="bg-gray-50 text-gray-800" data-theme="light">
1717
<Meta {title} {description} />
1818
<body class="min-h-full w-full">
1919
<Header {focus} />

src/pages/articles/[article].astro

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -31,51 +31,56 @@ if (article.data.author && !author)
3131
>
3232
{
3333
article.data.image && (
34-
<div class="mt-36 text-center lg:mt-48 lg:px-8">
34+
<div class="text-center lg:px-8">
3535
<LazyImage
3636
size="heading"
3737
transition:name={`article:cover:${article.id}`}
38-
width="1200"
39-
height="600"
4038
loading="eager"
41-
class="mr-auto ml-auto max-h-400 w-full max-w-screen-lg lg:rounded-2xl"
39+
class="mx-auto max-h-400 max-w-md lg:rounded-2xl"
4240
alt="イメージ画像"
4341
src={article.data.image}
4442
/>
4543
</div>
4644
)
4745
}
48-
<time class="mt-12 block text-center text-gray-500 lg:mt-24">
49-
{format(article.data.date, "yyyy-MM-dd HH:mm")}
50-
</time>
51-
{
52-
author && (
53-
<a
54-
href={`/members/${author.id}`}
55-
class="mx-auto mt-4 flex max-w-sm items-center gap-4 rounded-lg px-4 py-2 hover:bg-gray-100 lg:mt-8"
56-
>
57-
<div class="h-14 w-14 overflow-clip rounded-full bg-gray-200">
58-
<LazyImage
59-
size="small"
60-
alt="著者の写真"
61-
width="56"
62-
height="56"
63-
src={author.data.faceImage}
64-
class="h-full w-full"
65-
/>
66-
</div>
67-
<div class="flex-1">
68-
<div class="text-lg">{author.data.nameJa}</div>
69-
<div class="text-sm text-gray-800">{author.data.description}</div>
70-
</div>
71-
</a>
72-
)
73-
}
74-
<main class="prose mx-auto mt-6 mb-80 lg:mt-12">
75-
<h1 class="not-prose text-4xl">
46+
<div
47+
id="meta"
48+
class="mx-auto mt-4 flex max-w-xl flex-wrap justify-around px-4 align-middle sm:gap-8 lg:mt-24"
49+
>
50+
{
51+
author && (
52+
<a
53+
href={`/members/${author.id}`}
54+
class="flex max-w-sm min-w-75 items-center gap-4 rounded-lg px-4 py-2 hover:bg-gray-100"
55+
>
56+
<div class="h-14 w-14 overflow-clip rounded-full bg-gray-200">
57+
<LazyImage
58+
size="small"
59+
alt="著者"
60+
width="56"
61+
height="56"
62+
src={author.data.faceImage}
63+
class="h-full w-full"
64+
/>
65+
</div>
66+
<div class="flex-1">
67+
<div class="text-lg">{author.data.nameJa}</div>
68+
<div class="text-sm text-gray-800">{author.data.description}</div>
69+
</div>
70+
</a>
71+
)
72+
}
73+
<time class="my-auto mt-4 text-gray-500">
74+
{format(article.data.date, "yyyy-MM-dd")}
75+
</time>
76+
</div>
77+
<main class="mx-auto lg:mt-12">
78+
<h1 class="mx-auto my-8 max-w-2xl px-8 text-center text-2xl lg:text-3xl">
7679
{article.data.title}
7780
</h1>
78-
<Content />
81+
<article class="prose mx-auto max-w-xl px-8">
82+
<Content />
83+
</article>
7984
</main>
8085
<JoinUsCTA class="mt-24">
8186
ut.code(); に参加する準備はできましたか?

0 commit comments

Comments
 (0)