Skip to content

Commit eaaa540

Browse files
committed
feat[design]: Each card on the nav is now lightened giving a more vivid sensation
1 parent 603f575 commit eaaa540

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/components/react/Header.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ import SpotlightCard from "./SpotlightCard";
33
import { Sling as Hamburger } from "hamburger-react";
44
import { GoArrowUpRight } from "react-icons/go";
55

6+
function oklchGradient(
7+
L0: number, // lightness min
8+
L1: number, // lightness max
9+
C: number, // chroma
10+
h: number, // hue
11+
i: number,
12+
n: number,
13+
) {
14+
const t = n <= 1 ? 0 : i / (n - 1);
15+
const L = L0 + t * (L1 - L0);
16+
return `oklch(${L}% ${C} ${h})`;
17+
}
18+
619
const navs: Array<{
720
label: string;
821
links: Array<{ label: string; href: string }>;
@@ -66,6 +79,14 @@ export default function Header() {
6679
className={`mt-5 w-full flex flex-col gap-3 translate-y-100 opacity-0`}
6780
style={{
6881
animationDelay: `${i * 100 + 100}ms`,
82+
backgroundColor: oklchGradient(
83+
0,
84+
10,
85+
0.05,
86+
300,
87+
i,
88+
navs.length,
89+
),
6990
}}
7091
>
7192
<h3 className="text-lg font-bold cursor-default">{nav.label}</h3>

0 commit comments

Comments
 (0)