Skip to content

Commit

Permalink
replace icon by asset in some stories
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoskolodny committed Aug 21, 2024
1 parent d7a37fa commit 5317c10
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/__screenshot_tests__/callout-screenshot-test.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {openStoryPage, screen} from '../test-utils';

test.each`
actions | title | inverse | closable | icon | case
actions | title | inverse | closable | asset | case
${'button and link'} | ${'Some title'} | ${false} | ${true} | ${true} | ${''}
${'button and link'} | ${'Some title'} | ${true} | ${true} | ${true} | ${'over inverse'}
${'button and link'} | ${'Some title'} | ${false} | ${false} | ${true} | ${'not closable'}
${'link'} | ${'Some title'} | ${false} | ${true} | ${true} | ${'with button link'}
${'none'} | ${'Some title'} | ${false} | ${true} | ${true} | ${'without actions'}
${'none'} | ${''} | ${false} | ${false} | ${false} | ${'only description'}
${'none'} | ${''} | ${false} | ${true} | ${false} | ${'only description and closable'}
`('Callout $case', async ({actions, title, inverse, closable, icon}) => {
`('Callout $case', async ({actions, title, inverse, closable, asset}) => {
await openStoryPage({
id: 'components-callout--default',
args: {actions, title, inverse, closable, icon},
args: {actions, title, inverse, closable, asset},
});

const callout = await screen.findByRole('region');
Expand Down
2 changes: 1 addition & 1 deletion src/__screenshot_tests__/dialog-screenshot-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ test('Dialog optional elements are not displayed if not provided', async () => {
onAccept: false,
onCancel: false,
link: false,
icon: false,
asset: false,
extra: false,
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/__screenshot_tests__/feedback-screenshot-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ test('Info feedback screen with custom icon', async () => {
id: 'patterns-feedback-infofeedbackscreen--info',
skin: MOVISTAR_SKIN,
device: 'MOBILE_IOS',
args: {icon: 'custom'},
args: {asset: 'custom'},
});

const image = await page.screenshot();
Expand Down
8 changes: 4 additions & 4 deletions src/__stories__/callout-story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ type Args = {
title: string;
description: string;
actions: string;
icon: boolean;
asset: boolean;
closable: boolean;
inverse: boolean;
};

export const Default: StoryComponent<Args> = ({title, description, icon, actions, closable, inverse}) => {
export const Default: StoryComponent<Args> = ({title, description, asset, actions, closable, inverse}) => {
const button = actions.includes('button') ? (
<ButtonPrimary small onPress={() => {}}>
Action
Expand All @@ -42,7 +42,7 @@ export const Default: StoryComponent<Args> = ({title, description, icon, actions
<ResponsiveLayout isInverse={inverse}>
<Box paddingY={24}>
<Callout
icon={icon ? <IconBoxLight /> : undefined}
icon={asset ? <IconBoxLight /> : undefined}
onClose={closable ? () => {} : undefined}
title={title}
description={description}
Expand All @@ -62,7 +62,7 @@ Default.args = {
title: 'Some title',
description: 'This is a description for the callout',
actions: 'button and link',
icon: true,
asset: true,
closable: true,
inverse: false,
};
8 changes: 4 additions & 4 deletions src/__stories__/dialog-story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ type DialogArgs = {
onAccept: boolean;
onCancel: boolean;
link: boolean;
icon: boolean;
asset: boolean;
extra: boolean;
};

export const Dialog: StoryComponent<DialogArgs> = ({
onAccept,
onCancel,
link,
icon,
asset,
extra,
title,
subtitle,
Expand Down Expand Up @@ -120,7 +120,7 @@ export const Dialog: StoryComponent<DialogArgs> = ({
</Stack>
) : undefined,
link: link ? <ButtonLink href="https://google.com">Link</ButtonLink> : undefined,
icon: icon ? (
icon: asset ? (
<IconInformationUserLight color={skinVars.colors.brand} />
) : undefined,
onAccept: onAccept ? () => console.log('Accepted') : undefined,
Expand All @@ -144,6 +144,6 @@ Dialog.args = {
onAccept: true,
onCancel: true,
link: true,
icon: true,
asset: true,
extra: true,
};
10 changes: 5 additions & 5 deletions src/__stories__/info-feedback-screen-story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@ export default {
fullScreen: true,
},
argTypes: {
icon: {
asset: {
options: ['default', 'custom'],
control: {type: 'select'},
},
},
};

type Args = {
icon: string;
asset: string;
extra: boolean;
};

export const Info: StoryComponent<Args> = ({icon, extra}) => (
export const Info: StoryComponent<Args> = ({asset, extra}) => (
<InfoFeedbackScreen
title="I'm the title"
description="I'm the description"
primaryButton={<ButtonPrimary onPress={() => {}}>Action1</ButtonPrimary>}
Icon={icon === 'custom' ? IconError : undefined}
Icon={asset === 'custom' ? IconError : undefined}
extra={extra ? <Placeholder /> : undefined}
/>
);

Info.storyName = 'InfoFeedbackScreen';
Info.args = {
icon: 'default',
asset: 'default',
extra: false,
};

0 comments on commit 5317c10

Please sign in to comment.