import type { Meta, StoryObj } from '@storybook/react' import { Typography } from '../Typography' import { OrgSwitcher, type OrgOption } from './OrgSwitcher' const meta: Meta = { title: 'Blocks/OrgSwitcher', component: OrgSwitcher, argTypes: { organizations: { description: 'Array of organization options to display.', control: false, table: { type: { summary: 'OrgOption[]' }, }, }, disabled: { description: 'Disables the component, preventing user interaction.', control: 'boolean', table: { type: { summary: 'boolean' }, defaultValue: { summary: 'false' }, }, }, defaultOpen: { description: 'Whether the select should be open by default.', control: 'boolean', table: { type: { summary: 'boolean' }, defaultValue: { summary: 'false' }, }, }, onValueChange: { control: false }, }, args: { disabled: false, defaultOpen: true, // open: true, }, } as Meta export default meta const sampleOrganizations: OrgOption[] = [ { value: 'chainlink-labs', label: 'Chainlink Labs', initials: 'CL', }, { value: 'smartcontract-inc', label: 'Smartcontract Inc', initials: 'SC', }, ] const singleOrganization: OrgOption[] = [ { value: 'chainlink-labs', label: 'Chainlink Labs', initials: 'CL', }, ] export const Default: StoryObj = { render: (args, context) => { const openProp = context.viewMode === 'story' ? { defaultOpen: true } : {} return (
) }, } export const WithNavigation: StoryObj = { render: (args, context) => { const openProp = context.viewMode === 'story' ? { defaultOpen: true } : {} // Native browser navigation for Storybook const handleOrgChange = (orgValue: string) => { // Navigate to a new route window.location.href = `/organizations/${orgValue}` } return (
Will navigate to /organizations/[org] route
) }, } export const SingleOrganization: StoryObj = { render: (args) => { // Native browser navigation for Storybook const handleOrgChange = (orgValue: string) => { // Navigate to a new route window.location.href = `/organizations/${orgValue}` } return (
) }, }