import { wordpress } from '@wordpress/icons'; import { SVG, Path } from '@wordpress/primitives'; import { Icon } from '.'; import type { Meta, StoryFn } from '@storybook/react'; const meta: Meta< typeof Icon > = { title: 'Unpublished/Icon', component: Icon, parameters: { docs: { canvas: { sourceState: 'shown' } }, }, }; export default meta; const Template: StoryFn< typeof Icon > = ( args ) => ; export const Default = Template.bind( {} ); Default.args = { icon: wordpress, }; export const FillColor: StoryFn< typeof Icon > = ( args ) => { return (
); }; FillColor.args = { ...Default.args, }; /** * When `icon` is a function, it will be passed the `size` prop and any other additional props. */ export const WithAFunction = Template.bind( {} ); WithAFunction.args = { ...Default.args, icon: ( { size }: { size?: number } ) => ( WordPress ), }; WithAFunction.parameters = { docs: { source: { code: ` ( WordPress ) } /> `, }, }, }; const MyIconComponent = ( { size }: { size?: number } ) => ( ); /** * When `icon` is a component, it will be passed the `size` prop and any other additional props. */ export const WithAComponent = Template.bind( {} ); WithAComponent.args = { ...Default.args, icon: , }; WithAComponent.parameters = { docs: { source: { code: ` const MyIconComponent = ( { size } ) => ( ); } /> `, }, }, }; export const WithAnSVG = Template.bind( {} ); WithAnSVG.args = { ...Default.args, icon: ( ), };