Skip to content

Commit 6965e91

Browse files
authored
factorize animation; fix: mobile view (#19)
1 parent 1ea5d68 commit 6965e91

File tree

2 files changed

+32
-18
lines changed

2 files changed

+32
-18
lines changed

app/globals.css

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,33 @@
130130
.scrollbar-hide::-webkit-scrollbar {
131131
display: none;
132132
}
133+
134+
/* Animated underline that works with multi-line text */
135+
.animated-underline {
136+
background-image:
137+
linear-gradient(currentColor, currentColor),
138+
linear-gradient(hsl(var(--foreground) / 0.25), hsl(var(--foreground) / 0.25));
139+
background-size: 0% 1px, 100% 1px;
140+
background-position: left bottom;
141+
background-repeat: no-repeat;
142+
transition: background-size 300ms ease-out;
143+
}
144+
145+
.animated-underline:hover {
146+
background-size: 100% 1px, 100% 1px;
147+
}
148+
149+
.animated-underline-muted {
150+
background-image:
151+
linear-gradient(currentColor, currentColor),
152+
linear-gradient(hsl(var(--muted-foreground) / 0.3), hsl(var(--muted-foreground) / 0.3));
153+
background-size: 0% 1px, 100% 1px;
154+
background-position: left bottom;
155+
background-repeat: no-repeat;
156+
transition: background-size 300ms ease-out, color 200ms ease-out;
157+
}
158+
159+
.animated-underline-muted:hover {
160+
background-size: 100% 1px, 100% 1px;
161+
}
133162
}

app/page.tsx

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,18 @@ export default function Home() {
2727
<div className="space-y-5 lg:space-y-6">
2828
<h1 className="animate-fade-in text-3xl font-bold leading-[1.1] tracking-tight sm:text-4xl lg:text-[2.75rem] xl:text-5xl">
2929
We work at the intersection of{" "}
30-
<Link
31-
href="/research"
32-
className="group relative inline-block"
33-
>
30+
<Link href="/research" className="animated-underline">
3431
computational neuroscience
35-
<span className="absolute -bottom-0.5 left-0 h-[1px] w-full bg-foreground/25" />
36-
<span className="absolute -bottom-0.5 left-0 h-[1px] w-0 bg-foreground transition-all duration-300 group-hover:w-full" />
3732
</Link>{" "}
3833
and{" "}
39-
<Link
40-
href="/research"
41-
className="group relative inline-block"
42-
>
34+
<Link href="/research" className="animated-underline">
4335
machine learning
44-
<span className="absolute -bottom-0.5 left-0 h-[1px] w-full bg-foreground/25" />
45-
<span className="absolute -bottom-0.5 left-0 h-[1px] w-0 bg-foreground transition-all duration-300 group-hover:w-full" />
4636
</Link>
4737
</h1>
4838
<p className="animate-slide-up text-sm leading-relaxed text-muted-foreground sm:text-base lg:text-base">
4939
We are interested in understanding{" "}
50-
<Link
51-
href="/publications"
52-
className="group relative inline-block transition-colors hover:text-foreground"
53-
>
40+
<Link href="/publications" className="animated-underline-muted hover:text-foreground">
5441
behavior
55-
<span className="absolute -bottom-0.5 left-0 h-[1px] w-full bg-muted-foreground/30" />
56-
<span className="absolute -bottom-0.5 left-0 h-[1px] w-0 bg-foreground transition-all duration-300 group-hover:w-full" />
5742
</Link>{" "}
5843
in computational terms and in reverse-engineering the algorithms of the brain.
5944
</p>

0 commit comments

Comments
 (0)