@@ -15,24 +15,108 @@ const links = [
1515 name: " Review" ,
1616 url: " #review" ,
1717 },
18-
1918];
2019---
2120
22- <nav class =" bg-black/30 backdrop-blur-md fixed left-0 top-0 w-full z-10 h-[var(--navbar-height)] flex items-center" >
23- <div class =" w-full container mx-auto px-4 flex justify-between items-center" >
24- <Icon name =" logo" class =" w-12" />
25- <ul class =" hidden md:flex gap-6" >
21+ <nav class =" fixed left-0 top-0 w-full z-10 overflow-hidden" >
22+ <div
23+ class =" bg-black/30 backdrop-blur-md h-[var(--navbar-height)] flex items-center"
24+ >
25+ <div
26+ class =" w-full container mx-auto px-4 flex justify-between items-center"
27+ >
28+ <Icon name =" logo" class =" w-12" />
29+ <ul class =" hidden md:flex gap-6" >
30+ {
31+ links .map ((link ) => (
32+ <li class = " " >
33+ <a href = { link .url } class = " font-medium" >
34+ { link .name }
35+ </a >
36+ </li >
37+ ))
38+ }
39+ </ul >
40+ <Button class =" hidden md:flex" >Contact us</Button >
41+ <Button
42+ variant =" secondary"
43+ icon
44+ size =" default"
45+ class =" relative md:hidden"
46+ aria-expanded =" false"
47+ >
48+ <div
49+ class =" mobile-nav-bg bg-transparent inset-0 absolute rounded-full -z-10"
50+ >
51+ </div >
52+ <Icon name =" hamburger" class =" menu-open" />
53+ <Icon name =" close" class =" menu-close" />
54+ </Button >
55+ </div >
56+ </div >
57+ <section
58+ role =" tabpanel"
59+ tabindex =" 0"
60+ class =" mobile-nav relative md:hidden"
61+ aria-hidden =" true"
62+ >
63+ <div class =" flex flex-col gap-4 items-start" >
2664 {
2765 links .map ((link ) => (
28- <li class = " " >
29- <a href = { link .url } class = " font-medium" >
30- { link .name }
31- </a >
32- </li >
66+ <a href = { link .url } class = " font-medium font-lg py-2 px-4" >
67+ { link .name }
68+ </a >
3369 ))
3470 }
35- </ ul >
36- <Button class = " hidden md:flex " >Contact us</ Button >
37- </div >
71+ < Button variant = " outline-plain " class = " mx-4 mb-4 " >Contact us</ Button >
72+ </ div >
73+ </section >
3874</nav >
75+ <style >
76+ .mobile-nav {
77+ display: grid;
78+ grid-template-rows: 0fr;
79+ transition: grid-template-rows 500ms;
80+ }
81+ .mobile-nav > div {
82+ overflow: hidden;
83+ }
84+
85+ .mobile-nav[aria-hidden="false"] {
86+ grid-template-rows: 1fr;
87+ }
88+ .mobile-nav-bg {
89+ transition:
90+ transform 500ms,
91+ background-color 500ms;
92+ }
93+ [aria-expanded="false"] .menu-open {
94+ display: block;
95+ }
96+ [aria-expanded="false"] .menu-close {
97+ display: none;
98+ }
99+ [aria-expanded="true"] .menu-open {
100+ display: none;
101+ }
102+ [aria-expanded="true"] .menu-close {
103+ display: block;
104+ }
105+
106+ [aria-expanded="true"] .mobile-nav-bg {
107+ background-color: rgb(109, 51, 204);
108+ transform: scale(35);
109+ }
110+ </style >
111+ <script >
112+ const button = document.querySelector("button[aria-expanded]");
113+ const mobileNav = document.querySelector(".mobile-nav");
114+ if (!button || !mobileNav) {
115+ throw new Error("Missing button or mobile nav");
116+ }
117+ button.addEventListener("click", () => {
118+ const expanded = button.getAttribute("aria-expanded") === "true";
119+ button.setAttribute("aria-expanded", `${!expanded}`);
120+ mobileNav.setAttribute("aria-hidden", `${expanded}`);
121+ });
122+ </script >
0 commit comments