Open wladpaiva opened 2 years ago
import { useEffect, useGlobals } from '@storybook/client-api';
// ....
export const ButtonStory: Story<PropsWithChildren<ButtonProps>> = (args) => {
const [_, updateGlobals] = useGlobals();
useEffect(() => {
// enable dark mode when component mounts
updateGlobals({ darkMode: true });
// disable dark mode when component unmounts
return () => updateGlobals({ darkMode: false });
}, []);
return (
<Button {...args}>{args.children}</Button>
);
};
ButtonStory.args = {
variant: ButtonVariant.PRIMARY,
children: 'Button',
};
I wonder if there is any way we could set up default for specific stories. It would make a lot faster to test impact of changes using chromatic