import { AfFiNeIcon } from '@blocksuite/icons/rc'; import type { Meta } from '@storybook/react'; import clsx from 'clsx'; import { type ReactElement, useCallback, useEffect, useState } from 'react'; import { Switch } from '../switch'; import * as styles from './button.stories.css'; import type { IconButtonProps } from './icon-button'; import { IconButton } from './icon-button'; export default { title: 'UI/IconButton', component: IconButton, } satisfies Meta; const types: IconButtonProps['variant'][] = ['plain', 'solid', 'danger']; const sizes: IconButtonProps['size'][] = ['12', '14', '16', '20', '24']; const Groups = ({ children, ...props }: Omit & { children?: ReactElement; }) => { return ( {sizes.map(size => ( ))} {types.map(type => ( {sizes.map(size => ( ))} ))}
Type/Size{size}
{type} {children ?? }
); }; export const Default = () => ; export const Loading = () => { const [loading, setLoading] = useState(false); const toggleLoading = useCallback(() => setLoading(v => !v), []); useEffect(() => { setInterval(toggleLoading, 1000); }, [toggleLoading]); return ; }; export const OverrideViaClassName = () => { const [overrideBg, setOverrideBg] = useState(false); const [overrideBorder, setOverrideBorder] = useState(false); const [overridePrefixColor, setOverridePrefixColor] = useState(false); return (
Override background color
Override border color
Override icon color
); }; export const CustomSize = () => { const sizes = [ [13, 2], [15, 2], [17, 2], [19, 2], [21, 3], [23, 3], [25, 3], [27, 3], [29, 4], [31, 4], [33, 4], [35, 4], ]; return types.map(type => { return (
{sizes.map(size => (
Size: {size[0]}px
Padding: {size[1]}px
))}
); }); }; export const Disabled = () => ;