@@ -5,14 +5,12 @@ import Link from "next/link";
5
5
import { usePathname } from "next/navigation" ;
6
6
import { motion } from "framer-motion" ;
7
7
8
- import { MotionDiv , MotionLi } from "@/lib/framer/client" ;
9
- import { useMobile } from "@/hooks/useMobile" ;
8
+ import { MotionDiv , MotionLi , MotionUl } from "@/lib/framer/client" ;
10
9
11
10
import MobileMenu from "./MobileMenu.component" ;
12
11
13
12
export default function Header ( ) {
14
13
const pathname = usePathname ( ) ;
15
- const isMobile = useMobile ( ) ;
16
14
17
15
const links = [
18
16
{ title : "Home" , name : "Hjem" , hash : "#hjem" , href : "/" } ,
@@ -36,25 +34,44 @@ export default function Header() {
36
34
< header className = "z-[999] relative" >
37
35
< MotionDiv
38
36
className = "bg-slate-800 bg-opacity-80 fixed top-0 left-1/2 h-[4.5rem] w-full shadow rounded-none shadow-lg shadow-black/[0.03] backdrop-blur-[0.5rem] sm:top-6 sm:h-[3.25rem] sm:w-[36rem] sm:rounded-full dark:bg-gray-900 dark:border-black/40 dark:bg-opacity-75"
39
- //initial={isMobile ? { x: 0 } : { y: -50, x: "-50%", opacity: 0 }}
40
- //animate={isMobile ? { x: 0 } : { y: 0, x: "-50%", opacity: 1 }}
41
-
42
- initial = { { y : - 50 , x : "-50%" , opacity : 0 } }
43
- animate = { { y : 0 , x : "-50%" , opacity : 1 } }
44
- transition = { { duration : 0.6 } }
45
- > </ MotionDiv >
46
-
37
+ initial = { { y : - 100 , x : "-50%" , opacity : 0 } }
38
+ animate = { {
39
+ y : 0 ,
40
+ x : "-50%" ,
41
+ opacity : 1 ,
42
+ transition : {
43
+ y : { duration : 0.6 , ease : "easeOut" } ,
44
+ opacity : { duration : 0.6 , ease : "easeOut" } ,
45
+ } ,
46
+ } }
47
+ />
47
48
< nav className = "flex fixed top-[0.65rem] left-1/2 h-12 -translate-x-1/2 py-2 sm:top-[1.7rem] sm:h-[initial] sm:py-0 w-full max-w-[370px] justify-end md:justify-between items-center" >
48
- < ul className = "hidden md:flex md:w-[22rem] flex-wrap items-center justify-center gap-y-1 text-[0.9rem] font-medium text-slate-200 sm:w-[initial] sm:flex-nowrap sm:gap-5" >
49
+ < MotionUl
50
+ className = "hidden md:flex md:w-[22rem] flex-wrap items-center justify-center gap-y-1 text-[0.9rem] font-medium text-slate-200 sm:w-[initial] sm:flex-nowrap sm:gap-5"
51
+ variants = { {
52
+ hidden : { opacity : 0 } ,
53
+ visible : {
54
+ opacity : 1 ,
55
+ transition : {
56
+ staggerChildren : 0.1 ,
57
+ delayChildren : 0.3 ,
58
+ } ,
59
+ } ,
60
+ } }
61
+ initial = "hidden"
62
+ animate = "visible"
63
+ >
49
64
{ links . map ( ( link ) => (
50
65
< MotionLi
51
66
className = "h-3/4 flex items-center justify-center relative"
52
67
key = { link . hash }
53
- initial = { isMobile ? { } : { y : - 50 , opacity : 0 } }
54
- animate = { isMobile ? { } : { y : 0 , opacity : 1 } }
55
- transition = { { duration : 0.6 } }
68
+ variants = { {
69
+ hidden : { y : - 20 , opacity : 0 } ,
70
+ visible : { y : 0 , opacity : 1 } ,
71
+ } }
72
+ transition = { { duration : 0.3 } }
56
73
>
57
- < motion . div className = "relative" whileHover = "hover" >
74
+ < MotionDiv className = "relative" whileHover = "hover" >
58
75
< Link
59
76
prefetch = { true }
60
77
className = { `flex w-full items-center justify-center px-2 py-2 hover:text-white transition font-semibold text-lg ${
@@ -78,10 +95,10 @@ export default function Header() {
78
95
/>
79
96
</ div >
80
97
</ Link >
81
- </ motion . div >
98
+ </ MotionDiv >
82
99
</ MotionLi >
83
100
) ) }
84
- </ ul >
101
+ </ MotionUl >
85
102
< div id = "hamburger-div" data-cy = "hamburger-div" className = "md:hidden" >
86
103
< MobileMenu links = { links } />
87
104
</ div >
0 commit comments