Skip to content

Commit 4483153

Browse files
authored
Improve perfs (#104)
* Improve initial render * Cleanup * Up auth part * prerender header * Cleanup unused font
1 parent 06e2168 commit 4483153

15 files changed

Lines changed: 283 additions & 352 deletions

File tree

src/app/_components/Footer/styles.module.css

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
}
2222

2323
.description {
24-
font-family: var(--font-inter);
2524
font-weight: 400;
2625
font-size: 16px;
2726
line-height: 24px;
@@ -51,7 +50,6 @@
5150
}
5251

5352
.categoryName {
54-
font-family: var(--font-inter);
5553
font-weight: 600;
5654
font-size: 14px;
5755
line-height: 20px;
@@ -61,7 +59,6 @@
6159
}
6260

6361
.link {
64-
font-family: var(--font-inter);
6562
font-weight: 600;
6663
font-size: 16px;
6764
line-height: 24px;
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
"use client";
2+
3+
import cn from "classnames";
4+
import type { ReactNode } from "react";
5+
import { useState } from "react";
6+
import styles from "./styles.module.css";
7+
8+
export interface HeaderNavLink {
9+
content: string;
10+
href: string;
11+
className?: string;
12+
isCta?: boolean;
13+
leadingIcon?: ReactNode;
14+
target?: string;
15+
}
16+
17+
interface MobileMenuProps {
18+
isHome?: boolean;
19+
links: HeaderNavLink[];
20+
}
21+
22+
export default function MobileMenu({ isHome, links }: MobileMenuProps) {
23+
const [open, setOpen] = useState(false);
24+
25+
return (
26+
<>
27+
<button
28+
className={cn(styles.drawerButton, "z-10")}
29+
aria-expanded={open}
30+
aria-label="Toggle menu"
31+
onClick={() => setOpen((current) => !current)}
32+
type="button"
33+
>
34+
<span className="sr-only">Toggle navigation</span>
35+
<svg
36+
aria-hidden="true"
37+
className="h-6 w-6"
38+
fill="none"
39+
viewBox="0 0 24 24"
40+
>
41+
{open ? (
42+
<path
43+
d="M6 6l12 12M18 6 6 18"
44+
stroke="currentColor"
45+
strokeLinecap="round"
46+
strokeLinejoin="round"
47+
strokeWidth="2"
48+
/>
49+
) : (
50+
<path
51+
d="M4 7h16M4 12h16M4 17h16"
52+
stroke="currentColor"
53+
strokeLinecap="round"
54+
strokeLinejoin="round"
55+
strokeWidth="2"
56+
/>
57+
)}
58+
</svg>
59+
</button>
60+
61+
<div
62+
className={cn(
63+
styles.drawer,
64+
open && styles.open,
65+
isHome && styles.homeDrawer,
66+
)}
67+
>
68+
<nav className={cn(styles.mobileLinks, "!gap-4")} aria-label="Mobile">
69+
{links.map(
70+
({ href, target, content, className, leadingIcon, isCta }) => (
71+
<a
72+
key={href}
73+
href={href}
74+
target={target}
75+
rel={target === "_blank" ? "noopener noreferrer" : undefined}
76+
onClick={() => setOpen(false)}
77+
className={cn(
78+
styles.link,
79+
isCta && styles.ctaLinkOverride,
80+
className,
81+
)}
82+
>
83+
{leadingIcon ? (
84+
<span className="inline-flex items-center gap-2">
85+
{leadingIcon}
86+
<span>{content}</span>
87+
</span>
88+
) : (
89+
content
90+
)}
91+
</a>
92+
),
93+
)}
94+
</nav>
95+
</div>
96+
</>
97+
);
98+
}

0 commit comments

Comments
 (0)