Skip to content

Commit 6a6ca58

Browse files
Add animation to menu
1 parent 49b48ac commit 6a6ca58

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

src/components/navigation/NavigationReact.jsx

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,18 +127,40 @@ function NavigationReact(props) {
127127
</div>
128128

129129
{isHamburgerMenuOpen && (
130-
<div className="flex flex-col py-2 bg-gray-50 border-y-2 absolute left-0 right-0 z-40 hamburger-menu">
130+
<div className="flex flex-col py-2 bg-gray-50 border-y-2 absolute left-0 right-0 z-40 transition-opacity duration-200 ease-in-out opacity-100">
131131
{navLinks.map((navLink, index) => (
132132
<a
133133
key={index}
134134
onClick={() => handleHamburgerMenuClick()}
135-
className="py-3 px-4 text-gray-800 hover:text-blue-700 hover:bg-gray-100"
135+
className="py-3 px-4 text-gray-800 hover:text-blue-700 hover:bg-gray-100 transition-all duration-200 ease-in-out"
136+
style={{
137+
animationName: "fadeIn",
138+
animationDuration: "200ms",
139+
animationTimingFunction: "ease-in-out",
140+
animationFillMode: "forwards",
141+
animationDelay: `${index * 50}ms`,
142+
opacity: 0,
143+
transform: "translateX(-10px)",
144+
}}
136145
href={navLink.href}
137146
target={navLink.target}
138147
>
139148
{navLink.linkText}
140149
</a>
141150
))}
151+
152+
<style jsx>{`
153+
@keyframes fadeIn {
154+
from {
155+
opacity: 0;
156+
transform: translateX(-10px);
157+
}
158+
to {
159+
opacity: 1;
160+
transform: translateX(0);
161+
}
162+
}
163+
`}</style>
142164
</div>
143165
)}
144166
</nav>

0 commit comments

Comments
 (0)