diff --git a/components/header/header.tsx b/components/header/header.tsx index 2c304a6..c51e624 100644 --- a/components/header/header.tsx +++ b/components/header/header.tsx @@ -12,7 +12,7 @@ import { DropdownTrigger, DropdownMenu, DropdownItem, - Button as HeroUIButton + Button as HeroUIButton, } from "@heroui/react" import { useEffect, useState } from "react" import Image from "next/image" @@ -73,7 +73,10 @@ const Header: Component = () => { {paths.map((item, index) => { if (item.subpaths === undefined) { - return + return ( + { {item.name} + ) } else { // eslint-disable-next-line react/jsx-key - return - - - - {item.name} - - - - - {item.subpaths.map(subitem => - - {subitem.name} - - )} - - + return ( + + + + + {item.name} + + + + + {item.subpaths.map(subitem => ( + + {subitem.name} + + ))} + + + ) } })} @@ -121,20 +128,59 @@ const Header: Component = () => { {/*Innholdet i hamburgermeny - Vises bare på små skjermer*/} -
- {paths.map((item, index) => ( - - - {item.icon} +
+ {paths.map((item, index) => { + if (!item.subpaths) { + return ( + + setIsMenuOpen(false)}> + {item.icon} + {item.name} + + + ) + } + return ( +
+
+ + + {item.icon} + {item.name} + + + + + - {item.name} - - - ))} +
+ {item.subpaths.map(subitem => ( + setIsMenuOpen(false)}> + {subitem.name} + + ))} +
+
+
+ ) + })}