Skip to content

Commit

Permalink
Improve Storybook DX further
Browse files Browse the repository at this point in the history
- the `actions` control for JSX is very annoying, this makes it take up less space on the pane and also super easy to toggle on/off
  • Loading branch information
cee-chen committed Oct 18, 2023
1 parent 5ac2f4b commit 30e0dc5
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/components/comment_list/comment_event.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,24 @@ const meta: Meta<EuiCommentEventProps> = {
control: { type: 'radio' },
defaultValue: undefined,
},
actions: {
control: 'radio',
options: ['Example action', 'No actions'],
mapping: {
'Example action': (
<EuiButtonIcon
title="Custom action"
aria-label="Custom action"
color="text"
iconType="copy"
/>
),
'No actions': null,
},
},
},
};

const exampleAction = (
<EuiButtonIcon
title="Custom action"
aria-label="Custom action"
color="text"
iconType="copy"
/>
);

export default meta;
type Story = StoryObj<EuiCommentEventProps>;

Expand All @@ -55,7 +61,7 @@ export const Regular: Story = {
eventIcon: 'faceHappy',
eventIconAriaLabel: 'Happy face comment icon',
timestamp: 'on Jan 1, 2020',
actions: exampleAction,
actions: 'Example action',
children:
'Far out in the uncharted backwaters of the unfashionable end of the western spiral arm of the Galaxy lies a small unregarded yellow sun.',
},
Expand All @@ -67,12 +73,13 @@ export const Update: Story = {
eventIcon: 'faceHappy',
eventIconAriaLabel: 'Happy face comment icon',
timestamp: 'on Jan 1, 2020',
actions: exampleAction,
actions: 'Example action',
},
};

export const Custom: Story = {
args: {
actions: 'No actions',
children:
'No header or wrapper should appear if no event, icon, timestamp, or actions are passed',
},
Expand Down

0 comments on commit 30e0dc5

Please sign in to comment.