Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(Storybook): fix theme default values for stories opened in a new tab #1261

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,19 @@ const getTheme = (
selectedPlatform?: Platform,
selectedColorScheme?: ColorScheme
): ThemeConfig => {
const skin = selectedSkin ?? MOVISTAR_SKIN;
const platform = selectedPlatform ?? 'desktop';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When opening a story in a new tab without using any url params for the skin/platform/colorScheme, the platform was being set to desktop as fallback. This is wrong and it should have been fixed when we added the logic to avoid flashes between first and second render in storybook (#1048).

const colorScheme = selectedColorScheme ?? 'auto';
const themeConfig = AVAILABLE_THEMES.find(({skin: skinConfig}) => skinConfig.name === skin) || Movistar;
const themeConfig =
AVAILABLE_THEMES.find(({skin: skinConfig}) => skinConfig.name === selectedSkin) || Movistar;
return {
...themeConfig,
colorScheme,
platformOverrides: {
platform,
insideNovumNativeApp: platform !== 'desktop',
},
...(selectedColorScheme ? {colorScheme: selectedColorScheme} : {}),
...(selectedPlatform
? {
platformOverrides: {
platform: selectedPlatform,
insideNovumNativeApp: selectedPlatform !== 'desktop',
},
}
: {}),
enableTabFocus: true,
dimensions: {
headerMobileHeight: 'mistica',
Expand Down
Loading