Add a type on CatalogDecorator (#1742)
* Add a type on CatalogDecorator Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * Type more catalogs Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> --------- Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com>
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
import { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import { IconBell } from '@/ui/icon';
|
||||
import {
|
||||
CatalogDecorator,
|
||||
CatalogDimension,
|
||||
CatalogOptions,
|
||||
} from '~/testing/decorators/CatalogDecorator';
|
||||
import { CatalogDecorator } from '~/testing/decorators/CatalogDecorator';
|
||||
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
||||
import { CatalogStory } from '~/testing/types';
|
||||
|
||||
import { MenuItemAccent } from '../../types/MenuItemAccent';
|
||||
import { MenuItem } from '../MenuItem';
|
||||
@@ -33,7 +30,7 @@ export const Default: Story = {
|
||||
decorators: [ComponentDecorator],
|
||||
};
|
||||
|
||||
export const Catalog: Story = {
|
||||
export const Catalog: CatalogStory<Story, typeof MenuItem> = {
|
||||
args: { ...Default.args },
|
||||
argTypes: {
|
||||
accent: { control: false },
|
||||
@@ -98,15 +95,17 @@ export const Catalog: Story = {
|
||||
],
|
||||
};
|
||||
}
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
},
|
||||
},
|
||||
] as CatalogDimension[],
|
||||
],
|
||||
options: {
|
||||
elementContainer: {
|
||||
width: 200,
|
||||
},
|
||||
} as CatalogOptions,
|
||||
},
|
||||
},
|
||||
},
|
||||
decorators: [CatalogDecorator],
|
||||
|
||||
@@ -2,12 +2,9 @@ import { Meta, StoryObj } from '@storybook/react';
|
||||
import { Command } from 'cmdk';
|
||||
|
||||
import { IconBell } from '@/ui/icon';
|
||||
import {
|
||||
CatalogDecorator,
|
||||
CatalogDimension,
|
||||
CatalogOptions,
|
||||
} from '~/testing/decorators/CatalogDecorator';
|
||||
import { CatalogDecorator } from '~/testing/decorators/CatalogDecorator';
|
||||
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
||||
import { CatalogStory } from '~/testing/types';
|
||||
|
||||
import { MenuItemCommand } from '../MenuItemCommand';
|
||||
|
||||
@@ -39,7 +36,7 @@ export const Default: Story = {
|
||||
decorators: [ComponentDecorator],
|
||||
};
|
||||
|
||||
export const Catalog: Story = {
|
||||
export const Catalog: CatalogStory<Story, typeof MenuItemCommand> = {
|
||||
args: { LeftIcon: IconBell, text: 'Menu item', command: '⌘1' },
|
||||
argTypes: {
|
||||
className: { control: false },
|
||||
@@ -60,7 +57,7 @@ export const Catalog: Story = {
|
||||
{
|
||||
name: 'selected',
|
||||
values: [true, false],
|
||||
props: (selected: boolean) => ({ selected }),
|
||||
props: () => ({}),
|
||||
labels: (selected: boolean) =>
|
||||
selected ? 'Selected' : 'Not selected',
|
||||
},
|
||||
@@ -78,12 +75,12 @@ export const Catalog: Story = {
|
||||
}
|
||||
},
|
||||
},
|
||||
] as CatalogDimension[],
|
||||
],
|
||||
options: {
|
||||
elementContainer: {
|
||||
width: 200,
|
||||
},
|
||||
} as CatalogOptions,
|
||||
},
|
||||
},
|
||||
},
|
||||
render: (props) => (
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import {
|
||||
CatalogOptions,
|
||||
} from '~/testing/decorators/CatalogDecorator';
|
||||
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
||||
import { CatalogStory } from '~/testing/types';
|
||||
|
||||
import { MenuItemMultiSelect } from '../MenuItemMultiSelect';
|
||||
|
||||
@@ -26,7 +27,7 @@ export const Default: Story = {
|
||||
decorators: [ComponentDecorator],
|
||||
};
|
||||
|
||||
export const Catalog: Story = {
|
||||
export const Catalog: CatalogStory<Story, typeof MenuItemMultiSelect> = {
|
||||
args: { LeftIcon: IconBell, text: 'Menu item' },
|
||||
argTypes: {
|
||||
className: { control: false },
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
CatalogOptions,
|
||||
} from '~/testing/decorators/CatalogDecorator';
|
||||
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
||||
import { CatalogStory } from '~/testing/types';
|
||||
|
||||
import { MenuItemNavigate } from '../MenuItemNavigate';
|
||||
|
||||
@@ -26,7 +27,7 @@ export const Default: Story = {
|
||||
decorators: [ComponentDecorator],
|
||||
};
|
||||
|
||||
export const Catalog: Story = {
|
||||
export const Catalog: CatalogStory<Story, typeof MenuItemNavigate> = {
|
||||
args: { LeftIcon: IconBell, text: 'Menu item' },
|
||||
argTypes: {
|
||||
className: { control: false },
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
CatalogOptions,
|
||||
} from '~/testing/decorators/CatalogDecorator';
|
||||
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
||||
import { CatalogStory } from '~/testing/types';
|
||||
|
||||
import { MenuItemSelect } from '../MenuItemSelect';
|
||||
|
||||
@@ -30,7 +31,7 @@ export const Default: Story = {
|
||||
decorators: [ComponentDecorator],
|
||||
};
|
||||
|
||||
export const Catalog: Story = {
|
||||
export const Catalog: CatalogStory<Story, typeof MenuItemSelect> = {
|
||||
args: { LeftIcon: IconBell, text: 'Menu item' },
|
||||
argTypes: {
|
||||
className: { control: false },
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
CatalogOptions,
|
||||
} from '~/testing/decorators/CatalogDecorator';
|
||||
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
||||
import { CatalogStory } from '~/testing/types';
|
||||
|
||||
import { MenuItemToggle } from '../MenuItemToggle';
|
||||
|
||||
@@ -26,7 +27,7 @@ export const Default: Story = {
|
||||
decorators: [ComponentDecorator],
|
||||
};
|
||||
|
||||
export const Catalog: Story = {
|
||||
export const Catalog: CatalogStory<Story, typeof MenuItemToggle> = {
|
||||
args: { LeftIcon: IconBell, text: 'Menu item' },
|
||||
argTypes: {
|
||||
className: { control: false },
|
||||
|
||||
Reference in New Issue
Block a user