Files
g-butandClaude Opus 4.5 43260cfef2 refactor: rebuild navigation as modular megamenu system
Architecture following DRY, SSOT, SoC principles:

Types (types/navigation.ts):
- MegaMenuHeader, MegaMenuFooter, MegaMenuConfig for dropdown config
- MenuChildItem, MenuItem with proper typing
- NavItemProps, MobileNavProps for component contracts

Components (components/navigation/):
- NavItem: Unified handler for links, dropdowns, CTA buttons
- MegaMenuPanel: Configurable panel with header/footer support
- MegaMenuItem: Individual dropdown item with icon/description
- MobileNav: Extracted mobile drawer (SoC)

Data (data/menuItems.ts):
- SSOT for all navigation with megaMenu config per section
- Helper functions: getNavItems(), getButtonItems()

Features:
- Portal pattern for proper dropdown overlay
- Configurable columns (1-3), headers, footers per section
- Consistent styling with Tailwind

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 00:44:27 +01:00

74 lines
1.4 KiB
TypeScript

import type { Route } from 'next';
/**
* Configuration for megamenu section header
*/
export interface MegaMenuHeader {
title: string;
subtitle?: string;
gradient?: string;
}
/**
* Configuration for megamenu section footer with CTA
*/
export interface MegaMenuFooter {
label: string;
href: Route;
}
/**
* Megamenu section configuration
*/
export interface MegaMenuConfig {
/** Number of columns in the grid (1-3) */
columns?: 1 | 2 | 3;
/** Optional header with title and subtitle */
header?: MegaMenuHeader;
/** Optional footer with CTA link */
footer?: MegaMenuFooter;
}
/**
* Child menu item (submenu entry)
*/
export interface MenuChildItem {
label: string;
path: Route;
description?: string;
icon?: string;
}
/**
* Top-level menu item
*/
export interface MenuItem {
label: string;
path: Route;
/** Child items for dropdown/megamenu */
children?: MenuChildItem[];
/** Render as CTA button instead of link */
isButton?: boolean;
/** Megamenu configuration (only used when children exist) */
megaMenu?: MegaMenuConfig;
}
/**
* Props for navigation components
*/
export interface NavItemProps {
item: MenuItem;
isActive?: boolean;
onNavigate?: () => void;
}
/**
* Props for mobile navigation
*/
export interface MobileNavProps {
isOpen: boolean;
onClose: () => void;
items: MenuItem[];
currentPath: string;
}