Skip to content

Commit

Permalink
WEB-2067 update story
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Ladaria committed Oct 8, 2024
1 parent ab19eeb commit e91f811
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/__screenshot_tests__/logo-screenshot-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ test.each(SKINS)('Logo with color override skin=%s', async (skin: KnownSkinName)
await openStoryPage({
id: 'components-logo--default',
skin,
args: {color: 'black', size: 64, type: 'imagotype'},
args: {color: '#000000', size: 64, type: 'imagotype'},
});

const story = await screen.findByTestId('logo');
Expand Down
17 changes: 13 additions & 4 deletions src/__stories__/logo-story.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import * as React from 'react';
import {BlauLogo, Logo, MovistarLogo, O2Logo, TelefonicaLogo, VivoLogo, TuLogo, O2NewLogo} from '../logo';
import {Box, ResponsiveLayout} from '../index';
import {Box, ResponsiveLayout, useTheme} from '../index';

const COLOR_OPTIONS = ['default', 'neutralHigh', 'neutralMedium', '#000000'] as const;

export default {
title: 'Components/Logo',
component: Logo,
parameters: {
fullScreen: true,
},
argTypes: {
color: {
options: COLOR_OPTIONS,
control: {type: 'select'},
},
},
};

type Args = {
Expand All @@ -17,7 +25,7 @@ type Args = {
action: 'none' | 'onPress' | 'href' | 'to';
forceBrandLogo: boolean;
brand: 'Movistar' | 'O2' | 'O2-new' | 'Vivo' | 'Telefonica' | 'Blau' | 'Tu';
color: string;
color: (typeof COLOR_OPTIONS)[number];
};

const getLogoActionProps = (action: string) => {
Expand Down Expand Up @@ -52,11 +60,12 @@ export const Default: StoryComponent<Args> = ({
brand,
color,
}) => {
const {colorValues} = useTheme();
const logoProps = {
...getLogoActionProps(action),
type,
size,
color: color || undefined,
color: color === 'default' ? undefined : colorValues[color as never] || color || undefined,
};

const CurrentLogo = {
Expand Down Expand Up @@ -88,7 +97,7 @@ Default.args = {
inverse: false,
forceBrandLogo: false,
brand: 'Movistar',
color: '',
color: 'default',
};

Default.argTypes = {
Expand Down

0 comments on commit e91f811

Please sign in to comment.