Refactor action buttons callback

This commit is contained in:
Gabe Kangas
2022-10-21 22:24:29 -07:00
parent fadc529a4a
commit 3fbbecc0e8
4 changed files with 147 additions and 113 deletions

View File

@@ -1,5 +1,6 @@
import React from 'react';
import { ComponentStory, ComponentMeta } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { ActionButton } from './ActionButton';
export default {
@@ -14,8 +15,14 @@ export default {
},
} as ComponentMeta<typeof ActionButton>;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const Template: ComponentStory<typeof ActionButton> = args => <ActionButton {...args} />;
const itemSelected = a => {
console.log('itemSelected', a);
action(a.title);
};
const Template: ComponentStory<typeof ActionButton> = args => (
<ActionButton externalActionSelected={itemSelected} {...args} />
);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const Example1 = Template.bind({});