Skip to content

Commit bcfdf67

Browse files
committed
ui: hightlight 未来のソフトウェア, perf: enable prerender on hover
1 parent 04a96f7 commit bcfdf67

File tree

3 files changed

+59
-23
lines changed

3 files changed

+59
-23
lines changed

astro.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,7 @@ export default defineConfig({
2929
prefetchAll: true,
3030
defaultStrategy: "hover",
3131
},
32+
experimental: {
33+
clientPrerender: true,
34+
},
3235
});

src/components/Header.astro

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

2323
<ClientRouter />
24-
<header class="sticky top-0 z-20 bg-white">
24+
<header class="fixed top-0 z-20 w-full bg-white">
2525
{
2626
banner.shown && (
2727
<div

src/pages/index.astro

Lines changed: 55 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ import LogoGMOMedia from "../images/logo-gmo-media.png";
1818
<Image
1919
alt=""
2020
loading="eager"
21-
class="sticky -top-40 -z-10 h-[120vh] w-full object-cover object-center"
21+
class="fixed -top-[0vh] -z-10 h-[100vh] w-full object-cover object-center motion-reduce:fixed motion-reduce:bottom-0"
2222
width="1920"
2323
height="1080"
2424
src={Hero}
2525
/>
26-
<div class="absolute top-[50%] left-10 max-w-lg bg-white/90 p-8 pb-24">
26+
<div class="absolute top-[40%] left-10 max-w-lg bg-white/90 p-8 pb-24">
2727
<h1 class="text-2xl md:text-3xl">
2828
<span class="inline-block">東京大学の</span><span class="inline-block"
2929
>ソフトウェア開発</span
@@ -37,7 +37,9 @@ import LogoGMOMedia from "../images/logo-gmo-media.png";
3737
</p>
3838
</div>
3939
</div>
40-
<section class="border-t-2 border-white bg-gray-100/70 backdrop-blur-lg">
40+
<section
41+
class="mt-[100vh] border-t-2 border-white bg-gray-100/70 backdrop-blur-lg"
42+
>
4143
<div class="container mx-auto px-4 py-12">
4244
<SectionHeader title="Activities" subtitle="活動内容" />
4345
<div class="mt-8 rounded-xl bg-white/100 p-8 shadow-2xl md:p-12">
@@ -98,34 +100,51 @@ import LogoGMOMedia from "../images/logo-gmo-media.png";
98100
</div>
99101
</section>
100102
<section class="bg-black py-80 text-white">
101-
<div class="mx-auto flex items-center gap-12 px-8">
102-
<div class="flex-grow self-center">
103-
<h1 class="text-6xl leading-snug">
104-
<span class="mb-3 inline-block">未来の<wbr />ソフトウェアを</span>
105-
<br />
106-
<span>デザインしよう</span>
103+
<div
104+
class="mx-auto block items-center gap-12 px-8 xl:flex xl:flex-row-reverse 2xl:mx-24"
105+
>
106+
<Image
107+
alt=""
108+
src={LabCafe}
109+
width="1000"
110+
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"
112+
/>
113+
<article class="mt-12 self-center md:ml-12">
114+
<h1 class="max-w-2xl text-4xl leading-snug sm:text-5xl md:text-6xl">
115+
<span
116+
id="text-future-software"
117+
class="mb-3 inline-block bg-white text-black"
118+
onmouseover="document.getElementById('text-future-software')?.setAttribute('data-highlighted', '');"
119+
tabindex="0"
120+
onfocus="document.getElementById('text-future-software')?.setAttribute('data-highlighted', '');"
121+
>未来の<wbr />ソフトウェア</span
122+
>を<br /><span>デザインしよう</span>
107123
</h1>
108-
<p class="mt-3 text-xl leading-loose text-gray-300">
124+
<p class="text-md mt-3 max-w-xl leading-loose text-gray-400 sm:text-xl">
109125
<span class="inline-block">
110126
ut.code(); で一緒にワクワクするソフトウェアを作りませんか?
111-
</span>
112-
<span class="inline-block">
113127
初心者から実務経験者、学年を問わずどなたでも大歓迎です。
114128
</span>
115129
</p>
116130
<ActionButton to="/join/" variant="dark" class="mt-8">
117131
JOIN US
118132
</ActionButton>
119-
</div>
120-
<div class="hidden flex-shrink self-stretch lg:block">
121-
<Image
122-
alt=""
123-
src={LabCafe}
124-
width="600"
125-
height="400"
126-
class="h-full w-full overflow-clip rounded-3xl object-cover"
127-
/>
128-
</div>
133+
</article>
134+
<script>
135+
var text = document.getElementById("text-future-software");
136+
document.onscroll = () => {
137+
if (!text) return;
138+
if (!document.scrollingElement) return;
139+
var screenTop = document.scrollingElement.scrollTop;
140+
var screenBottom = screenTop && +innerHeight;
141+
var textTop = text.getBoundingClientRect().top;
142+
143+
if (textTop < screenBottom - 500) {
144+
text.setAttribute("data-highlighted", "");
145+
}
146+
};
147+
</script>
129148
</div>
130149
</section>
131150
<section class="bg-gray-100/70 backdrop-blur-sm">
@@ -232,4 +251,18 @@ import LogoGMOMedia from "../images/logo-gmo-media.png";
232251
--underline-width: 0%;
233252
}
234253
}
254+
255+
@media not (prefers-reduced-motion) {
256+
#text-future-software {
257+
text-decoration: underline white;
258+
text-underline-offset: 12px;
259+
--bg-left: 0%;
260+
background: linear-gradient(white 0 0) bottom left/var(--bg-left, 0%) 100%
261+
no-repeat;
262+
transition: background-size 0.8s ease-in-out;
263+
}
264+
#text-future-software[data-highlighted] {
265+
--bg-left: 100%;
266+
}
267+
}
235268
</style>

0 commit comments

Comments
 (0)