From 68d261a3915eefbcc6c9fbf22e1beb2cf1e77478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateu=20Aguil=C3=B3=20Bosch?= Date: Mon, 14 Mar 2022 07:00:25 +0100 Subject: [PATCH] fix: correct copy pasta (#8) --- src/withDrupalTheme.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/withDrupalTheme.ts b/src/withDrupalTheme.ts index 35dbb02..2f9cfed 100644 --- a/src/withDrupalTheme.ts +++ b/src/withDrupalTheme.ts @@ -5,25 +5,27 @@ import { useGlobals, } from '@storybook/addons'; -export const withDrupalTheme = (StoryFn: StoryFunction, context: StoryContext) => { - const [{drupalTheme}] = useGlobals(); +export const withDrupalTheme = ( + StoryFn: StoryFunction, + context: StoryContext, +) => { + const [{ drupalTheme }] = useGlobals(); if (drupalTheme) { - console.log(`Rendering component using: ${drupalTheme}`) + console.log(`Rendering component using Drupal theme: ${drupalTheme}`); } const [globals, updateGlobals] = useGlobals(); useEffect(() => { const { - parameters: {drupalTheme, supportedDrupalThemes}, + parameters: { drupalTheme, supportedDrupalThemes }, } = context; - if (supportedDrupalThemes && !globals.locales) { - if (drupalTheme && !globals.locale) { - updateGlobals({drupalTheme, supportedDrupalThemes}); + if (supportedDrupalThemes && !globals.supportedDrupalThemes) { + if (drupalTheme && !globals.drupalTheme) { + updateGlobals({ drupalTheme, supportedDrupalThemes }); } else { - updateGlobals({supportedDrupalThemes}); + updateGlobals({ supportedDrupalThemes }); } } }, []); return StoryFn(undefined, undefined); }; -