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 { ActionButtonRow } from './ActionButtonRow';
import { ActionButton } from '../ActionButton/ActionButton';
@@ -42,7 +43,12 @@ const actions = [
},
];
const buttons = actions.map(action => <ActionButton action={action} />);
const itemSelected = a => {
console.log('itemSelected', a);
action(a.title);
};
const buttons = actions.map(a => <ActionButton externalActionSelected={itemSelected} action={a} />);
export const Example1 = Template.bind({});
Example1.args = {
buttons,