Skip to content

Commit 5dd6c56

Browse files
committed
feat(ui): smooth image transition
1 parent 13049e9 commit 5dd6c56

File tree

14 files changed

+75
-55
lines changed

14 files changed

+75
-55
lines changed

src/components/ActionButton.astro

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,27 @@ 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.25",
18+
"not-prose relative flex w-max items-center gap-4 rounded-full bg-gray-50 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,
2222
]}
2323
>
2424
<slot />
25-
<Icon id="icon" name="feather:arrow-right" class="relative h-8 w-8" />
25+
<Icon
26+
id="icon"
27+
name="feather:arrow-right"
28+
class="relative h-8 w-8 motion-reduce:left-1"
29+
/>
2630
</a>
2731
<style>
28-
/* TODO: @media not(prefers-reduced-motion) */
29-
#icon {
30-
left: -2px;
31-
transition: left 0.15s ease-out;
32-
}
33-
a:hover.motion #icon {
34-
left: 6px;
32+
@media not (prefers-reduced-motion) {
33+
#icon {
34+
left: -2px;
35+
transition: left 0.15s ease-out;
36+
}
37+
a:hover.motion #icon {
38+
left: 6px;
39+
}
3540
}
3641
</style>

src/components/ArticleList.astro

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,31 +46,32 @@ const articlesWithExcerpts = await Promise.all(
4646
const additionalProps = isFeatured
4747
? {
4848
cellClassName: "md:col-span-2 md:row-span-2",
49-
imageClassName: "max-h-[350px] md:max-h-[450px]",
49+
imageClassName: "max-h-[32rem] md:max-h-[48rem]",
5050
excerpt: text.slice(0, 300),
5151
}
5252
: {
5353
cellClassName: "",
54-
imageClassName: "max-h-[200px]",
54+
imageClassName: "max-h-[24rem]",
5555
excerpt: text.slice(0, 80),
5656
};
5757
return (
5858
<li class="contents">
5959
<a
6060
href={`/articles/${article.id}`}
6161
class:list={[
62-
"relative rounded-xl p-1 shadow-md hover:brightness-110 active:top-0.5",
62+
"relative rounded-xl bg-gray-50 p-1 shadow-md hover:brightness-110 active:top-0.5",
6363
additionalProps.cellClassName,
6464
]}
6565
>
6666
<Image
67+
transition:name={`article:cover:${article.id}`}
6768
loading={i < 5 ? "eager" : "lazy"}
6869
alt="カバー画像"
6970
height={48 * 4 * 4}
7071
width={48 * 4 * 4}
7172
src={article.data.image}
7273
class:list={[
73-
"animate-move w-full rounded-xl object-contain object-top",
74+
"animate-move w-full rounded-xl object-center",
7475
additionalProps.imageClassName,
7576
]}
7677
/>

src/components/Footer/FooterSection.astro

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const { title, links } = Astro.props;
1414
<li>
1515
<a
1616
href={link.to}
17-
class="link relative active:top-0.25"
17+
class="link relative active:top-0.25 motion-reduce:hover:underline"
1818
target={link.to.startsWith("/") ? "" : "_blank"}
1919
rel={link.to.startsWith("/") ? "" : "noreferrer"}
2020
>
@@ -26,16 +26,18 @@ const { title, links } = Astro.props;
2626
</ul>
2727
</div>
2828
<style>
29-
.link {
30-
background: linear-gradient(currentColor 0 0) bottom left/
31-
var(--underline-width, 0%) 0.1em no-repeat;
32-
text-decoration: none;
33-
transition: background-size 0.1s linear;
34-
}
35-
.link:hover {
36-
--underline-width: 100%;
37-
@starting-style {
38-
--underline-width: 0%;
29+
@media not (prefers-reduced-motion) {
30+
.link {
31+
background: linear-gradient(currentColor 0 0) bottom left/
32+
var(--underline-width, 0%) 0.1em no-repeat;
33+
text-decoration: none;
34+
transition: background-size 0.1s linear;
35+
}
36+
.link:hover {
37+
--underline-width: 100%;
38+
@starting-style {
39+
--underline-width: 0%;
40+
}
3941
}
4042
}
4143
</style>

src/components/Header.astro

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const { focus } = Astro.props;
2121
---
2222

2323
<ClientRouter />
24-
<header class="fixed top-0 z-20 w-full bg-white">
24+
<header class="fixed top-0 z-20 w-full bg-gray-50">
2525
{
2626
banner.shown && (
2727
<div
@@ -118,10 +118,9 @@ const { focus } = Astro.props;
118118
}
119119

120120
.navigation-bar {
121-
background: linear-gradient(currentColor 0 0) bottom left/
121+
background: linear-gradient(black 0 0) bottom left/
122122
var(--underline-width, 0%) 0.1em no-repeat;
123123
text-decoration: none;
124-
transition: background-size 0.5s;
125124
}
126125
.navigation-bar.current {
127126
background: linear-gradient(lawngreen 0 0) bottom left/
@@ -133,4 +132,9 @@ const { focus } = Astro.props;
133132
--underline-width: 0%;
134133
}
135134
}
135+
@media not (prefers-reduced-motion) {
136+
.navigation-bar {
137+
transition: background-size 0.5s;
138+
}
139+
}
136140
</style>

src/components/JoinUsCTA.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface Props {
66
const props = Astro.props;
77
---
88

9-
<section class:list={["bg-gray-100 py-12", props.class]}>
9+
<section class:list={["bg-gray-200 py-12", props.class]}>
1010
<div class="container mx-auto px-4 lg:max-w-screen-lg">
1111
<h2 class="text-2xl leading-normal"><slot /></h2>
1212
<p class="mt-4 text-gray-800">

src/components/ProjectList.astro

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,22 @@ if (variant === "compact") {
3232
]}
3333
>
3434
<a
35-
class="relative top-0 overflow-clip rounded-xl border border-gray-200 bg-white hover:brightness-95 active:top-0.25"
35+
class="relative top-0 overflow-clip rounded-xl border border-gray-200 bg-gray-50 hover:brightness-95 active:top-0.25"
3636
href={`/projects/${project.data.slug}`}
3737
>
3838
<Image
39+
transition:name={`project:image:${project.id}`}
3940
loading={i < 6 ? "eager" : "lazy"}
4041
width="800"
4142
height="600"
4243
alt="プロジェクトのイメージ画像"
4344
src={project.data.image}
44-
class="h-[16rem] w-full object-cover"
45+
class="max-h-[24rem] w-full object-fill"
4546
/>
4647
<div class="p-4">
47-
<h3 class="text-xl font-bold">{project.data.title}</h3>
48+
<h3 class="text-xl font-bold text-gray-800">
49+
{project.data.title}
50+
</h3>
4851
<p class="prose mt-2">
4952
{project.data.description.length < 120
5053
? project.data.description

src/components/per-page/SectionHeader.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ interface Props {
77
const { title, subtitle } = Astro.props;
88
---
99

10-
<h2 class="text-center text-4xl">{title}</h2>
11-
{subtitle && <h3 class="mt-2 text-center text-sm text-gray-500">{subtitle}</h3>}
10+
<h2 class="text-center text-4xl text-black">{title}</h2>
11+
{subtitle && <h3 class="mt-2 text-center text-sm text-gray-600">{subtitle}</h3>}

src/layouts/GlobalLayout.astro

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

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

src/pages/articles/[article].astro

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ if (article.data.author && !author)
3434
>
3535
{
3636
article.data.image && (
37-
<div class="mt-6 text-center lg:mt-12 lg:px-8">
37+
<div class="mt-36 text-center lg:mt-48 lg:px-8">
3838
<Image
39+
transition:name={`article:cover:${article.id}`}
3940
loading="eager"
40-
class="mr-auto ml-auto max-h-200 w-full max-w-screen-lg object-contain lg:isolate lg:overflow-clip lg:rounded-2xl"
41+
class="mr-auto ml-auto max-h-400 w-full max-w-screen-lg lg:rounded-2xl"
4142
alt="イメージ画像"
4243
src={article.data.image}
4344
/>
@@ -77,5 +78,3 @@ if (article.data.author && !author)
7778
ut.code(); に参加する準備はできましたか?
7879
</JoinUsCTA>
7980
</GlobalLayout>
80-
81-
); }

src/pages/index.astro

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ import LogoGMOMedia from "../images/logo-gmo-media.png";
2323
height="1080"
2424
src={Hero}
2525
/>
26-
<div class="absolute top-[40%] left-10 max-w-lg bg-white/90 p-8 pb-24">
26+
<div class="absolute top-[40%] left-10 max-w-lg bg-gray-50 p-8 pb-24">
2727
<h1 class="text-2xl md:text-3xl">
2828
<span class="inline-block">東京大学の</span><span class="inline-block"
2929
>ソフトウェア開発</span
3030
><span class="inline-block">コミュニティ</span>
3131
</h1>
3232
<div class="prose mt-3">
3333
<p>
34-
ut.code();
35-
は、東京大学のソフトウェアエンジニアリングコミュニティ・プログラミングサークルです。
34+
ut.code(); は、 2019
35+
年に発足した東京大学のソフトウェアエンジニアリングコミュニティ・プログラミングサークルです。
3636
プログラミングの学習・教育から、実社会で役立つソフトウェア製作まで、幅広い活動を行っています。
3737
</p>
3838
</div>
@@ -42,7 +42,7 @@ import LogoGMOMedia from "../images/logo-gmo-media.png";
4242
>
4343
<div class="container mx-auto px-4 py-12">
4444
<SectionHeader title="Activities" subtitle="活動内容" />
45-
<div class="mt-8 rounded-xl bg-white/100 p-8 shadow-2xl md:p-12">
45+
<div class="mt-8 rounded-xl bg-gray-50 p-8 shadow-2xl md:p-12">
4646
<ul class="flex flex-col gap-12 lg:flex-row">
4747
{
4848
[
@@ -90,7 +90,7 @@ import LogoGMOMedia from "../images/logo-gmo-media.png";
9090
</div>
9191
</div>
9292
</section>
93-
<section class="bg-white">
93+
<section class="bg-gray-50">
9494
<div class="px-12 py-12 lg:px-36">
9595
<SectionHeader title="Projects" subtitle="実施中のプロジェクト" />
9696
<ProjectList variant="compact" class="mt-10" />
@@ -101,14 +101,14 @@ import LogoGMOMedia from "../images/logo-gmo-media.png";
101101
</section>
102102
<section class="bg-black py-80 text-white">
103103
<div
104-
class="mx-auto block items-center gap-12 px-8 xl:flex xl:flex-row-reverse 2xl:mx-24"
104+
class="mx-auto block items-center gap-12 px-8 xl:flex xl:flex-row-reverse 2xl:mx-16 2xl:gap-20"
105105
>
106106
<Image
107107
alt=""
108108
src={LabCafe}
109109
width="1000"
110110
height="800"
111-
class="mr-6 ml-auto hidden h-full w-full max-w-2xl flex-1 overflow-clip rounded-3xl object-cover md:block xl:max-w-3xl"
111+
class="mr-6 ml-auto hidden h-full w-full max-w-2xl flex-1 overflow-clip rounded-3xl object-cover md:block xl:mb-60 xl:max-w-3xl"
112112
/>
113113
<article class="mt-12 self-center md:ml-12">
114114
<h1 class="max-w-2xl text-4xl leading-snug sm:text-5xl md:text-6xl">
@@ -121,7 +121,7 @@ import LogoGMOMedia from "../images/logo-gmo-media.png";
121121
>未来の<wbr />ソフトウェア</span
122122
>を<br /><span>デザインしよう</span>
123123
</h1>
124-
<p class="text-md mt-3 max-w-xl leading-loose text-gray-400 sm:text-xl">
124+
<p class="text-md mt-3 max-w-xl leading-loose text-gray-300 sm:text-xl">
125125
<span class="inline-block">
126126
ut.code(); で一緒にワクワクするソフトウェアを作りませんか?
127127
初心者から実務経験者、学年を問わずどなたでも大歓迎です。
@@ -188,7 +188,7 @@ import LogoGMOMedia from "../images/logo-gmo-media.png";
188188
</ul>
189189
</div>
190190
</section>
191-
<section class="bg-white">
191+
<section class="bg-gray-50">
192192
<div class="container mx-auto px-4 py-12">
193193
<SectionHeader title="News" subtitle="最新情報" />
194194
<ArticleList variant="compact" class="mt-10" />
@@ -197,7 +197,7 @@ import LogoGMOMedia from "../images/logo-gmo-media.png";
197197
</ActionButton>
198198
</div>
199199
</section>
200-
<section class="w-full bg-white">
200+
<section class="w-full bg-gray-50">
201201
<iframe
202202
title="ut.code(); 紹介動画"
203203
class="h-[300px] w-full sm:h-[400px] md:h-[500px] lg:h-[100vh]"
@@ -206,7 +206,7 @@ import LogoGMOMedia from "../images/logo-gmo-media.png";
206206
allow="picture-in-picture; web-share"
207207
allow-fullscreen></iframe>
208208
</section>
209-
<section class="bg-white">
209+
<section class="bg-gray-50">
210210
<div class="container mx-auto px-8 py-24">
211211
<SectionHeader title="協賛企業様" />
212212
<div class="mt-8 flex flex-wrap items-center justify-center gap-4">

0 commit comments

Comments
 (0)