File tree Expand file tree Collapse file tree 2 files changed +35
-34
lines changed
Expand file tree Collapse file tree 2 files changed +35
-34
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import { useState } from 'react';
22import { useSpring , animated } from 'react-spring' ;
33import Link from 'next/link' ;
44
5+ import LINKS from '../../utils/constants/LINKS' ;
6+
57/**
68 * Shows the mobile menu.
79 * Shows a X when mobile menu is expanded.
@@ -89,47 +91,26 @@ const Hamburger = () => {
8991 < line x1 = "6" y1 = "6" x2 = "18" y2 = "18" > </ line >
9092 </ animated . svg >
9193 </ label >
92-
9394 { isExpanded && (
9495 < animated . div
9596 style = { hamburgerSlideDownAnimation }
9697 id = "mobile-menu"
9798 className = "absolute right-0 z-10 w-full text-center text-black bg-white "
9899 >
99100 < ul >
100- < li className = "w-full p-4 border-t border-gray-400 border-solid rounded" >
101- < Link href = "/" >
102- < a
103- className = "inline-block px-4 py-2 no-underline hover:text-black hover:underline"
104- href = "#"
105- >
106- Hjem
107- </ a >
108- </ Link >
109- </ li >
110- < li className = "w-full p-4 border-t border-gray-400 border-solid rounded" >
111- < Link href = "/produkter" >
112- < a
113- className = "inline-block px-4 py-2 no-underline hover:text-black hover:underline"
114- href = "#"
115- >
116- Produkter
117- </ a >
118- </ Link >
119- </ li >
120- < li
121- id = "mobile-li"
122- className = "w-full p-4 border-t border-b border-gray-400 border-solid rounded"
123- >
124- < Link href = "/kategorier" >
125- < a
126- className = "inline-block px-4 py-2 no-underline hover:text-black hover:underline"
127- href = "#"
128- >
129- Kategorier
130- </ a >
131- </ Link >
132- </ li >
101+ { LINKS . map ( ( { id, title, href } ) => (
102+ < li
103+ key = { id }
104+ id = "mobile-li"
105+ className = "w-full p-4 border-t border-gray-400 border-solid rounded"
106+ >
107+ < Link href = { href } >
108+ < a className = "inline-block px-4 py-2 no-underline hover:text-black hover:underline" >
109+ { title }
110+ </ a >
111+ </ Link >
112+ </ li >
113+ ) ) }
133114 </ ul >
134115 </ animated . div >
135116 ) }
Original file line number Diff line number Diff line change 1+ //exports.default = [
2+ const LINKS = [
3+ {
4+ id : 0 ,
5+ title : 'Hjem' ,
6+ href : '/' ,
7+ } ,
8+ {
9+ id : 1 ,
10+ title : 'Produkter' ,
11+ href : '/produkter' ,
12+ } ,
13+ {
14+ id : 2 ,
15+ title : 'Kategorier' ,
16+ href : '/kategorier' ,
17+ } ,
18+ ] ;
19+
20+ export default LINKS ;
You can’t perform that action at this time.
0 commit comments