import type { Meta, StoryObj } from '@storybook/nextjs' import { fn } from 'storybook/test' import { useState } from 'react' import Dropdown, { type Item } from '.' const PRIMARY_ITEMS: Item[] = [ { value: 'rename', text: 'Rename' }, { value: 'duplicate', text: 'Duplicate' }, ] const SECONDARY_ITEMS: Item[] = [ { value: 'archive', text: Archive }, { value: 'delete', text: Delete }, ] const meta = { title: 'Base/Navigation/Dropdown', component: Dropdown, parameters: { docs: { description: { component: 'Small contextual menu with optional destructive section. Uses portal positioning utilities for precise placement.', }, }, }, tags: ['autodocs'], args: { items: PRIMARY_ITEMS, secondItems: SECONDARY_ITEMS, }, } satisfies Meta export default meta type Story = StoryObj const DropdownDemo = (props: React.ComponentProps) => { const [lastAction, setLastAction] = useState('None') return ( { setLastAction(String(item.value)) props.onSelect?.(item) }} /> Last action: {lastAction} ) } export const Playground: Story = { render: args => , args: { items: PRIMARY_ITEMS, secondItems: SECONDARY_ITEMS, onSelect: fn(), }, } export const CustomTrigger: Story = { render: args => ( ( Actions ▾ )} /> ), args: { items: PRIMARY_ITEMS, onSelect: fn(), }, }