Skip to content

Commit a679dca

Browse files
committed
fix: mobile menu animation
1 parent c62d220 commit a679dca

1 file changed

Lines changed: 23 additions & 12 deletions

File tree

apps/marketing-app/src/app/components/mobile-menu.tsx

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,40 @@ const navVariants = {
2828
visible: {
2929
opacity: 1,
3030
transition: {
31-
staggerChildren: 0.05,
31+
staggerChildren: 0.03,
3232
},
3333
},
3434
} satisfies Variants;
3535

3636
const linkVariants = {
3737
hidden: {
3838
opacity: 0,
39-
x: -20,
39+
y: -10,
40+
transition: {
41+
type: "spring",
42+
stiffness: 500,
43+
damping: 20,
44+
},
4045
},
4146
visible: {
4247
opacity: 1,
43-
x: 0,
48+
y: 0,
49+
transition: {
50+
type: "spring",
51+
stiffness: 400,
52+
damping: 35,
53+
mass: 0.8,
54+
},
4455
},
4556
} satisfies Variants;
4657

4758
export function MobileMenu() {
4859
const [isOpen, setIsOpen] = useState(false);
4960

5061
return (
51-
<>
62+
<div className="z-50 hidden items-center justify-center gap-6 max-sm:flex">
5263
<button
53-
className="relative z-50 hidden h-6 w-6 touch-manipulation flex-col justify-center gap-2 p-1 max-sm:flex"
64+
className="relative flex h-6 w-6 touch-manipulation flex-col justify-center gap-2"
5465
aria-label="Toggle menu"
5566
onClick={() => setIsOpen(!isOpen)}
5667
>
@@ -80,12 +91,12 @@ export function MobileMenu() {
8091
variants={navVariants}
8192
initial="hidden"
8293
animate="visible"
83-
className="flex flex-col gap-6 text-lg"
94+
className="flex flex-col text-lg"
8495
>
8596
<motion.div variants={linkVariants}>
8697
<Link
8798
href="#how-it-works"
88-
className="border-border block w-full border-b pb-4"
99+
className="block w-full py-6"
89100
onClick={() => setIsOpen(false)}
90101
>
91102
How it works
@@ -94,7 +105,7 @@ export function MobileMenu() {
94105
<motion.div variants={linkVariants}>
95106
<Link
96107
href="#features"
97-
className="border-border block w-full border-b pb-4"
108+
className="block w-full py-6"
98109
onClick={() => setIsOpen(false)}
99110
>
100111
Features
@@ -103,7 +114,7 @@ export function MobileMenu() {
103114
<motion.div variants={linkVariants}>
104115
<Link
105116
href="#team"
106-
className="border-border block w-full border-b pb-4"
117+
className="block w-full py-6"
107118
onClick={() => setIsOpen(false)}
108119
>
109120
Use cases
@@ -112,14 +123,14 @@ export function MobileMenu() {
112123
<motion.div variants={linkVariants}>
113124
<Link
114125
href="/"
115-
className="border-border block w-full border-b pb-4"
126+
className="block w-full py-6"
116127
onClick={() => setIsOpen(false)}
117128
>
118129
Login
119130
</Link>
120131
</motion.div>
121132
<motion.div variants={linkVariants}>
122-
<div className="border-border block w-full border-b pb-4">
133+
<div className="block w-full py-6">
123134
<WaitlistDialog
124135
buttonSize="lg"
125136
className="h-12 w-full text-lg font-normal"
@@ -130,6 +141,6 @@ export function MobileMenu() {
130141
</motion.div>
131142
)}
132143
</AnimatePresence>
133-
</>
144+
</div>
134145
);
135146
}

0 commit comments

Comments
 (0)