39 lines
1,000 B
TypeScript
39 lines
1,000 B
TypeScript
import type { Meta, StoryObj } from '@storybook/react';
|
|
import { ViewToggle } from './ViewToggle';
|
|
import { useArgs } from '@storybook/preview-api';
|
|
|
|
const meta = {
|
|
title: 'Components/Features/Tracks/ViewToggle',
|
|
component: ViewToggle,
|
|
tags: ['autodocs'],
|
|
argTypes: {
|
|
onChange: { action: 'changed' },
|
|
value: {
|
|
control: 'radio',
|
|
options: ['list', 'grid']
|
|
}
|
|
},
|
|
} satisfies Meta<typeof ViewToggle>;
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
export const Default: Story = {
|
|
render: (args) => {
|
|
const [{ value }, updateArgs] = useArgs();
|
|
return <ViewToggle {...args} value={value} onChange={(newValue) => updateArgs({ value: newValue })} />;
|
|
},
|
|
args: {
|
|
value: 'list' as const,
|
|
showLabels: true,
|
|
onChange: () => { },
|
|
}
|
|
};
|
|
|
|
export const IconOnly: Story = {
|
|
args: {
|
|
value: 'grid' as const,
|
|
showLabels: false,
|
|
onChange: () => { },
|
|
}
|
|
};
|