Skip to content

Commit

Permalink
docs(storybook): update instances of util functions to use updated pa…
Browse files Browse the repository at this point in the history
…ttern
  • Loading branch information
mgadewoll committed Mar 25, 2024
1 parent f8cfad9 commit 8a6a585
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 43 deletions.
18 changes: 8 additions & 10 deletions src/components/i18n/i18n.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ type Story = StoryObj<Props>;
export const SingleToken: Story = {
argTypes: {
default: { control: { type: 'text' } },
...hideStorybookControls(['children', 'tokens', 'defaults']),
},
args: {
token: 'euiI18nBasic.basicexample',
Expand All @@ -35,21 +34,19 @@ export const SingleToken: Story = {
},
};

hideStorybookControls(SingleToken, ['children', 'tokens', 'defaults']);

export const Interpolation: Story = {
argTypes: {
...hideStorybookControls(['children', 'tokens', 'defaults']),
},
args: {
token: 'euiI18nInterpolation.clickedCount',
default: 'Clicked on button {count} times.',
values: { count: 3 },
},
};

hideStorybookControls(Interpolation, ['children', 'tokens', 'defaults']);

export const MultipleTokens: Story = {
argTypes: {
...hideStorybookControls(['token', 'default']),
},
args: {
tokens: ['euiI18n.title', 'euiI18n.description'],
defaults: ['Card title', 'Card description'],
Expand All @@ -64,10 +61,9 @@ export const MultipleTokens: Story = {
),
};

hideStorybookControls(MultipleTokens, ['token', 'default']);

export const MultipleTokenInterpolation: Story = {
argTypes: {
...hideStorybookControls(['token', 'default']),
},
args: {
tokens: ['euiI18nMulti.title', 'euiI18nMulti.description'],
defaults: [
Expand All @@ -85,3 +81,5 @@ export const MultipleTokenInterpolation: Story = {
</EuiI18n>
),
};

hideStorybookControls(MultipleTokenInterpolation, ['token', 'default']);
6 changes: 4 additions & 2 deletions src/components/i18n/i18n_number.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export default meta;
type Story = StoryObj<EuiI18nNumberProps>;

export const SingleValue: Story = {
argTypes: hideStorybookControls(['children', 'values']),
args: {
value: 99,
},
Expand All @@ -33,8 +32,9 @@ export const SingleValue: Story = {
),
};

hideStorybookControls(SingleValue, ['children', 'values']);

export const MultipleValues: Story = {
argTypes: hideStorybookControls(['value']),
args: {
values: [0, 1, 2],
children: (values: ReactChild[]) => (
Expand All @@ -48,3 +48,5 @@ export const MultipleValues: Story = {
),
},
};

hideStorybookControls(MultipleValues, ['value']);
10 changes: 6 additions & 4 deletions src/components/list_group/list_group.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ import { EuiListGroupItem } from './list_group_item';
const meta: Meta<EuiListGroupProps> = {
title: 'Display/EuiListGroup/EuiListGroup',
component: EuiListGroup,
argTypes: moveStorybookControlsToCategory(
['color', 'size'],
'EuiListGroupItem props'
),
args: {
flush: false,
bordered: false,
Expand All @@ -30,6 +26,12 @@ const meta: Meta<EuiListGroupProps> = {
},
};

moveStorybookControlsToCategory(
meta,
['color', 'size'],
'EuiListGroupItem props'
);

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

Expand Down
3 changes: 2 additions & 1 deletion src/components/list_group/list_group_item.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const meta: Meta<EuiListGroupItemProps> = {
title: 'Display/EuiListGroup/EuiListGroupItem',
component: EuiListGroupItem,
argTypes: {
...disableStorybookControls(['buttonRef']),
iconType: {
control: { type: 'text' },
},
Expand All @@ -27,6 +26,8 @@ const meta: Meta<EuiListGroupItemProps> = {
},
};

disableStorybookControls(meta, ['buttonRef']);

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,23 @@ import {
const meta: Meta<EuiPinnableListGroupProps> = {
title: 'Display/EuiPinnableListGroup',
component: EuiPinnableListGroup,
argTypes: moveStorybookControlsToCategory(
[
'bordered',
'color',
'flush',
'gutterSize',
'maxWidth',
'showToolTips',
'size',
'wrapText',
],
'EuiListGroup props'
),
};

moveStorybookControlsToCategory(
meta,
[
'bordered',
'color',
'flush',
'gutterSize',
'maxWidth',
'showToolTips',
'size',
'wrapText',
],
'EuiListGroup props'
);

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

Expand Down
16 changes: 8 additions & 8 deletions src/components/markdown_editor/markdown_format.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const meta: Meta<EuiMarkdownFormatProps> = {
control: { type: 'radio' },
options: [undefined, ...ALIGNMENTS],
},
...hideStorybookControls(['aria-label']),
},
// Component defaults
args: {
Expand All @@ -54,17 +53,18 @@ const meta: Meta<EuiMarkdownFormatProps> = {
},
};

moveStorybookControlsToCategory(
meta,
['textAlign', 'color', 'grow'],
'EuiText props'
);

hideStorybookControls(meta, ['aria-label']);

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

export const Playground: Story = {
// TODO: move this to the component level once utils are updated to fully support merged configs (#7583)
argTypes: {
...moveStorybookControlsToCategory(
['textAlign', 'color', 'grow'],
'EuiText props'
),
},
args: {
children: initialContent,
},
Expand Down
10 changes: 6 additions & 4 deletions src/components/modal/confirm_modal.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ const meta: Meta<EuiConfirmModalProps> = {
options: [undefined, CONFIRM_BUTTON, CANCEL_BUTTON],
},
buttonColor: { control: { type: 'select' }, options: BUTTON_COLORS },
...moveStorybookControlsToCategory(
['role', 'maxWidth', 'initialFocus'],
'EuiModal props'
),
},
args: {
buttonColor: 'primary',
Expand All @@ -43,6 +39,12 @@ const meta: Meta<EuiConfirmModalProps> = {
},
};

moveStorybookControlsToCategory(
meta,
['role', 'maxWidth', 'initialFocus'],
'EuiModal props'
);

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

Expand Down
3 changes: 2 additions & 1 deletion src/components/overlay_mask/overlay_mask.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ const meta: Meta<EuiOverlayMaskProps> = {
component: EuiOverlayMask,
argTypes: {
children: { control: { type: 'text' } },
...disableStorybookControls(['maskRef']),
},
// Component defaults
args: {
headerZindexLocation: 'above',
},
};

disableStorybookControls(meta, ['maskRef']);

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

Expand Down

0 comments on commit 8a6a585

Please sign in to comment.