diff --git a/components/navbar/NavbarHumas.tsx b/components/navbar/NavbarHumas.tsx index a4e5cc5..62e5368 100644 --- a/components/navbar/NavbarHumas.tsx +++ b/components/navbar/NavbarHumas.tsx @@ -1,20 +1,39 @@ 'use client' +import { siteConfig } from '@/config/site'; import { Input } from '@nextui-org/input'; import { Navbar, NavbarContent, NavbarItem, NavbarMenu, NavbarMenuItem, NavbarMenuToggle } from '@nextui-org/navbar'; -import { Button, Dropdown, DropdownItem, DropdownMenu, DropdownSection, DropdownTrigger, autocomplete } from '@nextui-org/react'; -import Link from "next/link"; -import { ChevronDownIcon, ChevronRightIcon, ChevronRightWhite, ChevronUpIcon, FbIcon, IdnIcon, IgIcon, SearchIcon, TtIcon, TwIcon, YtIcon } from '../icons'; -import { ThemeSwitch } from '../theme-switch'; +import { Button, Dropdown, DropdownItem, DropdownMenu, DropdownTrigger } from '@nextui-org/react'; import Image from 'next/image'; -import { siteConfig } from '@/config/site'; +import Link from "next/link"; import { useState } from 'react'; +import { ChevronDownIcon, ChevronRightIcon, ChevronUpIcon, FbIcon, IdnIcon, IgIcon, SearchIcon, TtIcon, TwIcon, YtIcon } from '../icons'; +import { ThemeSwitch } from '../theme-switch'; + +interface MenuItem { + key: string; + label: string; + href: URL; + submenu?: SubMenuItem[]; +} + +interface SubMenuItem { + label: string; + href: string; +} + +interface DropdownOpenState { + [key: string]: boolean; +} + export default function NavbarHumas() { + const [dropdownOpen, setDropdownOpen] = useState({}); - const [dropdownOpen, setDropdownOpen] = useState(false); - - const toggleDropdown = () => { - setDropdownOpen(!dropdownOpen); + const toggleDropdown = (key: any) => { + setDropdownOpen({ + ...dropdownOpen, + [key]: !dropdownOpen[key] + }); }; const searchInput = ( @@ -249,34 +268,38 @@ export default function NavbarHumas() { {/* {searchInput} */}
- {siteConfig.humasMenuItems.map((item, index) => ( - - {item.submenu ? ( -
- - {dropdownOpen && ( -
- {item.submenu.map((subItem, subIndex) => ( - - {subItem.label} - - ))} -
+ ) )}
- ) : ( - - {item.label} - +
+ {dropdownOpen[item.key] && item.submenu && ( +
+ {item.submenu.map((subItem, subIndex) => ( +
+ + {subItem.label} + +
+ ))} +
)} - +
))}
diff --git a/config/site.ts b/config/site.ts index 5fa9b1b..d52edc5 100644 --- a/config/site.ts +++ b/config/site.ts @@ -41,7 +41,7 @@ export const siteConfig = { }, { label: "Profile Pimpinan POLRI", - href: "/visi-misi" + href: "/profile-pimpinan-polri" }, { label: "Struktur Organisasi", @@ -76,43 +76,43 @@ export const siteConfig = { }, { label: "Pelayanan SIM", - href: "/visi-misi" + href: "https://www.digitalkorlantas.id/sim/" }, { label: "Pelayanan e-Rikkes SIM", - href: "/struktur-organisasi" + href: "https://erikkes.id/" }, { label: "Pelayanan Tes Psikologi SIM", - href: "/visi-misi" + href: "https://eppsi.id/" }, { label: "Pelayanan e-Avis", - href: "/tugas-dan-fungsi" + href: "https://e-avis.korlantas.polri.go.id/" }, { label: "Pelayanan Samsat Digital", - href: "#" + href: "https://samsatdigital.id/" }, { label: "Pelayanan SKCK", - href: "#" + href: "https://play.google.com/store/apps/details?id=superapps.polri.presisi.presisi&hl=en_US" }, { label: "Pelayanan Propam Presisi", - href: "#" + href: "https://play.google.com/store/apps/details?id=com.stk.pengaduanpropam" }, { label: "Pelayanan Dumas Presisi", - href: "#" + href: "https://dumaspresisi.polri.go.id/" }, { label: "Pelayanan Binmas", - href: "#" + href: "https://bos.polri.go.id/login" }, { label: "Wistle Blower System", - href: "#" + href: "https://play.google.com/store/apps/details?id=id.go.ssdmpolri.pengaduanappsbarupolri2" }, ] },