import type { Meta, StoryObj } from '@storybook/nextjs-vite' import { useState } from 'react' import { fn } from 'storybook/test' import { BracketCurlyIcon, ChartDonutIcon, IdCardIcon, MonitorIcon, Settings02Icon, } from '../components/icons-v2-generated' import { AppLayout, AppLayoutDrawer, AppLayoutDrawerBody, AppLayoutDrawerContent, AppLayoutDrawerDescription, AppLayoutDrawerHeader, AppLayoutDrawerTitle, } from '../components/navigation' import { NavigationSidebarConfig } from '../types/navigation' const navigationItems: NavigationSidebarConfig['items'] = [ { id: 'dashboard', label: 'Dashboard', icon: , path: '/dashboard', isActive: true }, { id: 'customers', label: 'Customers', icon: , path: '/customers' }, { id: 'devices', label: 'Devices', icon: , path: '/devices' }, { id: 'scripts', label: 'Scripts', icon: , path: '/scripts' }, { id: 'settings', label: 'Settings', icon: , path: '/settings', section: 'secondary' }, ] const meta = { title: 'Navigation/AppLayoutSidebar', component: AppLayout, parameters: { layout: 'fullscreen', docs: { description: { component: ` \`AppLayout\` wired so the **Mingo AI** header button toggles a right-side, in-layout sidebar (an \`AppLayoutDrawer\`). The sidebar renders inside the main content area — the navigation sidebar and header stay visible and interactive while it is open. The header button reflects the open state via \`isMingoAIActive\`, and the sidebar is persistent: clicks on the header/sidebar/overlay do not close it (use the X button or Escape). `, }, }, }, tags: ['autodocs'], args: { children: null, sidebarConfig: { items: navigationItems, onNavigate: fn(), onToggleMinimized: fn() }, headerProps: {}, mobileBurgerMenuProps: {}, }, } satisfies Meta export default meta type Story = StoryObj function DashboardChildren() { return ( Devices Overview 8,250 Devices in Total {[ { label: 'Active Devices', value: '6,930' }, { label: 'Active Tickets', value: '136' }, { label: 'Resolved Tickets', value: '825' }, ].map((stat) => ( {stat.label} {stat.value} ))} Click Mingo AI in the header to open the chat sidebar. ) } /** * Mingo AI header button toggles the right-side chat sidebar. */ export const Default: Story = { render: function Render() { const [open, setOpen] = useState(false) return ( setOpen((prev) => !prev), isMingoAIActive: open, showUser: true, userName: 'Alex Developer', userEmail: 'alex@openframe.dev', onProfile: fn(), onLogout: fn(), }} mobileBurgerMenuProps={{ user: { userName: 'Alex Developer', userEmail: 'alex@openframe.dev', userRole: 'Admin', }, }} drawer={ Mingo AI Ask Mingo about your devices, tickets, and scripts. Chat content goes here. } > ) }, } /** * Resizable chat sidebar — drag the inside edge to resize. Starts open. */ export const Resizable: Story = { render: function Render() { const [open, setOpen] = useState(true) return ( setOpen((prev) => !prev), isMingoAIActive: open, showUser: true, userName: 'Alex Developer', userEmail: 'alex@openframe.dev', onProfile: fn(), onLogout: fn(), }} mobileBurgerMenuProps={{ user: { userName: 'Alex Developer', userEmail: 'alex@openframe.dev', userRole: 'Admin', }, }} drawer={ Mingo AI Drag the grip on the left edge to resize the chat sidebar. } > ) }, }
8,250 Devices in Total
{stat.label}
{stat.value}
Click Mingo AI in the header to open the chat sidebar.
Chat content goes here.
Drag the grip on the left edge to resize the chat sidebar.