import type { Meta, StoryObj } from '@storybook/react'; import { Header } from './header'; import { BrowserRouter, Link } from 'react-router-dom'; import { Home, Bell, Mail, User, Settings, LogOut, Users, FileText, FolderOpen, RefreshCw, } from 'lucide-react'; import React from 'react'; import { Badge } from '../../ui/badge'; import { Button } from '../../ui/button'; const meta: Meta = { title: 'Layout/Header', component: Header, decorators: [ Story => (
Page Content Area
), ], parameters: { layout: 'fullscreen', }, }; export default meta; type Story = StoryObj; /** * Default story: breadcrumbs are the recommended primary pattern. * Always use breadcrumbs when the page has a navigation hierarchy. */ export const Default: Story = { args: { breadcrumbs: [ { label: 'Home', href: '/', icon: }, { label: 'Users', href: '/users' }, { label: 'Edit Profile' }, ], user: { name: 'Pedro Duarte', email: 'pedro@example.com', avatar: 'https://github.com/shadcn.png', }, showSettings: true, showLogout: true, }, }; /** * Deep navigation: breadcrumbs support unlimited hierarchy levels. * This example shows 5 levels of navigation depth. */ export const DeepNavigation: Story = { args: { breadcrumbs: [ { label: 'Home', href: '/', icon: }, { label: 'Settings', href: '/settings', icon: }, { label: 'Organization', href: '/settings/org', icon: }, { label: 'Teams', href: '/settings/org/teams', icon: }, { label: 'Engineering', href: '/settings/org/teams/engineering' }, { label: 'Access Policies' }, ], user: { name: 'Ana Costa', email: 'ana.costa@xertica.ai', }, }, }; /** * Title-only mode: exception pattern for standalone pages with no navigation. * Use `title` only when the page has no parent or breadcrumb context. */ export const TitleOnly: Story = { args: { title: 'Dashboard', showLanguageSelector: true, showThemeToggle: true, }, }; /** * With custom action buttons in the header toolbar. */ export const WithActions: Story = { args: { breadcrumbs: [ { label: 'Home', href: '/', icon: }, { label: 'Messages' }, ], actions: [ { id: 'notifications', icon: , onClick: () => alert('Notifications'), }, { id: 'mail', label: 'Inbox', icon: , onClick: () => alert('Mailbox'), }, ], user: { name: 'John Doe', avatar: 'https://github.com/johndoe.png', }, }, }; /** * Custom user profile dropdown menu items. */ export const CustomUserMenu: Story = { args: { breadcrumbs: [ { label: 'Home', href: '/', icon: }, { label: 'Settings' }, ], user: { name: 'Admin User', menuItems: [ { id: 'profile', label: 'My Profile', icon: , onClick: () => {}, }, { id: ' billing', label: 'Billing', icon: , onClick: () => {}, }, { id: 'logout', label: 'Sign Out', icon: , className: 'text-destructive focus:text-destructive', onClick: () => {}, }, ], }, }, }; /** * Breadcrumb slot: custom element rendered right after the breadcrumb area. * Accepts any React node — badges, buttons, status chips, etc. */ export const WithBreadcrumbSlot: Story = { args: { breadcrumbs: [ { label: 'Home', href: '/', icon: }, { label: 'Deployments' }, ], breadcrumbSlot: (
Beta
), user: { name: 'Pedro Duarte', email: 'pedro@example.com', }, }, }; /** * SPA Navigation: uses `renderLink` with React Router's `Link` component * to prevent full-page reloads when navigating breadcrumbs. */ export const WithReactRouter: Story = { args: { breadcrumbs: [ { label: 'Home', href: '/', icon: }, { label: 'Settings', href: '/settings', icon: }, { label: 'Users', href: '/settings/users', icon: }, { label: 'Edit Profile' }, ], renderLink: (href, props) => , user: { name: 'Maria Souza', email: 'maria@xertica.ai', }, }, };