diff --git a/src/components/Icon/__stories__/Docs.mdx b/src/components/Icon/__stories__/Docs.mdx new file mode 100644 index 0000000000..01484f2491 --- /dev/null +++ b/src/components/Icon/__stories__/Docs.mdx @@ -0,0 +1,7 @@ +import {Meta, Markdown} from '@storybook/addon-docs'; +import * as Stories from './Icon.stories'; +import Readme from '../README.md?raw'; + + + +{Readme} diff --git a/src/components/Icon/__stories__/Icon.stories.tsx b/src/components/Icon/__stories__/Icon.stories.tsx index f5b388954b..a8505a7f40 100644 --- a/src/components/Icon/__stories__/Icon.stories.tsx +++ b/src/components/Icon/__stories__/Icon.stories.tsx @@ -1,18 +1,40 @@ import React from 'react'; -import {Gear} from '@gravity-ui/icons'; -import type {Meta, StoryFn} from '@storybook/react'; +import {Envelope, Gear, Rocket} from '@gravity-ui/icons'; +import type {Meta, StoryObj} from '@storybook/react'; +import {Showcase} from '../../../demo/Showcase'; import {Icon} from '../Icon'; -import type {IconProps} from '../Icon'; + +const icons = [Gear, Envelope, Rocket].reduce((acc, fn) => { + acc[fn.name] = fn; + return acc; +}, {} as {[key: string]: React.FunctionComponent}); export default { title: 'Components/Data Display/Icon', component: Icon, + argTypes: { + data: { + options: Object.keys(icons), + mapping: icons, + }, + }, + args: { + data: 'Gear', + }, } as Meta; -const DefaultTemplate: StoryFn = (args) => ; -export const Default = DefaultTemplate.bind({}); -Default.args = { - data: Gear, +type Story = StoryObj; + +export const Default: Story = {}; + +export const Size: Story = { + render: (args) => ( + + + + + + ), };