diff --git a/src/app/darmasaba/_com/Navbar.tsx b/src/app/darmasaba/_com/Navbar.tsx
index 698b210d..da5ded81 100644
--- a/src/app/darmasaba/_com/Navbar.tsx
+++ b/src/app/darmasaba/_com/Navbar.tsx
@@ -5,7 +5,7 @@ import stateNav from "@/state/state-nav";
import { ActionIcon, Box, Burger, Group, Image, Paper, ScrollArea, Stack, Text, Tooltip } from "@mantine/core";
import { IconSquareArrowRight } from "@tabler/icons-react";
import { motion } from "framer-motion";
-import { useRouter } from "next/navigation";
+import { usePathname, useRouter } from "next/navigation";
import { useSnapshot } from "valtio";
import { MenuItem } from "../../../../types/menu-item";
import { NavbarMainMenu } from "./NavbarMainMenu";
@@ -19,14 +19,18 @@ export function Navbar() {
-
+ {/* Desktop navbar (muncul mulai 992px ke atas) */}
+
+
+
-
+ {/* Mobile navbar (muncul di bawah 992px, termasuk iPad Mini) */}
+
-
+
-
+
+
+
{mobileOpen && (
)}
+
{(item || isSearch) && }
);
@@ -76,40 +95,105 @@ export function Navbar() {
function NavbarMobile({ listNavbar }: { listNavbar: MenuItem[] }) {
const router = useRouter();
+ const pathname = usePathname(); // 👈 untuk cek path aktif
+
+ // fungsi bantu: cek apakah path sekarang sama dengan menu / sub-menu
+ const isActive = (href?: string) => href && pathname.startsWith(href);
+
return (
-
-
- {listNavbar.map((item, k) => (
-
- {
- if (item.href) {
- router.push(item.href);
- stateNav.mobileOpen = false;
- }
- }}
- style={{
- cursor: item.href ? "pointer" : "default",
- opacity: item.href ? 1 : 0.8
- }}
- >
-
- {item.name}
-
-
-
- {item.children && (
-
-
-
- )}
-
- ))}
+
+
+ {listNavbar.map((item, k) => {
+ const active = isActive(item.href);
+ return (
+
+ {
+ if (item.href) {
+ router.push(item.href);
+ stateNav.mobileOpen = false;
+ }
+ }}
+ style={{
+ cursor: item.href ? "pointer" : "default",
+ transition: "background 0.15s ease",
+ borderLeft: active ? "4px solid #1e66f5" : "4px solid transparent",
+ }}
+ >
+
+
+ {item.name}
+
+ {item.href && (
+
+ )}
+
+
+
+ {/* Submenu */}
+ {item.children && (
+
+ {item.children.map((child, j) => {
+ const childActive = isActive(child.href);
+ return (
+ {
+ if (child.href) {
+ router.push(child.href);
+ stateNav.mobileOpen = false;
+ }
+ }}
+ style={{
+ cursor: child.href ? "pointer" : "default",
+ opacity: child.href ? 1 : 0.8,
+ borderRadius: "0.5rem",
+ backgroundColor: childActive ? "#e7f0ff" : "transparent",
+ borderLeft: childActive ? "3px solid #1e66f5" : "3px solid transparent",
+ transition: "background 0.15s ease",
+ }}
+ >
+
+ {child.name}
+
+
+
+ );
+ })}
+
+ )}
+
+ );
+ })}
);
}
+