Skip to content

Commit 5605c76

Browse files
committed
Animation for header menu
1 parent 776c75d commit 5605c76

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

src/app/components/HeaderMenu.module.css

+22-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,30 @@
55
}
66
}
77

8+
@keyframes slideDown {
9+
from {
10+
transform: translateY(-100%);
11+
opacity: 0;
12+
}
13+
to {
14+
transform: translateY(0);
15+
opacity: 1;
16+
}
17+
}
18+
19+
.headerVisible {
20+
animation: slideDown 0.5s ease-out forwards;
21+
}
22+
823
.header {
24+
position: fixed;
25+
top: 0;
26+
left: 0;
27+
right: 0;
28+
height: rem(56);
29+
z-index: 2;
30+
animation: slideDown 0.5s ease-out forwards;
931
background-color: var(--mantine-color-body);
10-
height: rem(56px);
1132
border-bottom: rem(1px) solid
1233
light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-4));
1334
}

src/app/components/HeaderMenu.tsx

+4-11
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import classes from "./HeaderMenu.module.css";
1515
import Image from "next/image";
1616
import Link from "next/link";
1717
import { IconBrandFacebook, IconBrandLinkedin } from "@tabler/icons-react";
18+
import { Fade } from "react-awesome-reveal";
1819

1920
const links = [
2021
{ link: "/#about", label: "About" },
@@ -101,17 +102,9 @@ export function HeaderMenu() {
101102
return (
102103
<>
103104
<header
104-
className={classes.header}
105-
style={{
106-
position: "fixed",
107-
top: 0,
108-
left: 0,
109-
right: 0,
110-
height: rem(56),
111-
zIndex: 2,
112-
transition: "transform 400ms ease",
113-
backgroundColor: "var(--mantine-color-body)",
114-
}}
105+
className={`${classes.header} ${
106+
showHeader ? classes.headerVisible : ""
107+
}`}
115108
>
116109
<Container size="lg">
117110
<div className={classes.inner}>

0 commit comments

Comments
 (0)