This commit is contained in:
@@ -1,14 +1,7 @@
|
||||
import { useComputed, useSignal } from "@preact/signals";
|
||||
import { useEffect } from "preact/hooks";
|
||||
import {
|
||||
Home,
|
||||
NotebookPen,
|
||||
BriefcaseBusiness,
|
||||
CodeXml,
|
||||
Terminal as TerminalIcon,
|
||||
Megaphone,
|
||||
} from "lucide-preact";
|
||||
import { navigationItems } from '../config/data';
|
||||
import type { LucideIcon } from '../types';
|
||||
|
||||
interface NavigationBarProps {
|
||||
currentPath: string;
|
||||
@@ -26,6 +19,9 @@ export default function NavigationBar({ currentPath }: NavigationBarProps) {
|
||||
return prevScrollPos.value > currentPos;
|
||||
});
|
||||
|
||||
// Filter out disabled navigation items
|
||||
const enabledNavigationItems = navigationItems.filter(item => item.enabled !== false);
|
||||
|
||||
// Update client path when location changes
|
||||
useEffect(() => {
|
||||
const updatePath = () => {
|
||||
@@ -67,15 +63,6 @@ export default function NavigationBar({ currentPath }: NavigationBarProps) {
|
||||
? activePath.slice(0, -1)
|
||||
: activePath;
|
||||
|
||||
const iconMap = {
|
||||
Home,
|
||||
NotebookPen,
|
||||
BriefcaseBusiness,
|
||||
CodeXml,
|
||||
TerminalIcon,
|
||||
Megaphone,
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
let scrollTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
|
||||
@@ -106,8 +93,8 @@ export default function NavigationBar({ currentPath }: NavigationBarProps) {
|
||||
>
|
||||
<div class="overflow-visible">
|
||||
<ul class="menu menu-horizontal bg-base-200 rounded-box p-1.5 sm:p-2 shadow-lg flex flex-nowrap whitespace-nowrap">
|
||||
{navigationItems.map((item) => {
|
||||
const Icon = iconMap[item.icon as keyof typeof iconMap];
|
||||
{enabledNavigationItems.map((item) => {
|
||||
const Icon = item.icon as LucideIcon;
|
||||
const isActive = item.isActive
|
||||
? item.isActive(normalizedPath)
|
||||
: normalizedPath === item.path;
|
||||
|
Reference in New Issue
Block a user