From eea0a82ffaa1fa92e9f0c283bdd4bb3f5e1a4bcd Mon Sep 17 00:00:00 2001 From: Lukas Weiss Date: Thu, 12 Jan 2023 15:30:09 +0100 Subject: [PATCH] improve theme docs by showing parent group in theme json (#174) --- .storybook/components/Theme.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.storybook/components/Theme.tsx b/.storybook/components/Theme.tsx index 1a0d9623..76ca8e8b 100644 --- a/.storybook/components/Theme.tsx +++ b/.storybook/components/Theme.tsx @@ -10,18 +10,20 @@ export function Theme({ component: string items?: string[] }): ReactElement { - const theme = items - ? Object.fromEntries( - // eslint-disable-next-line - // @ts-ignore - items.map((item) => [item, defaultTheme?.[component]?.[item]]) - ) - : defaultTheme?.[component] + const theme = { + [component]: items + ? Object.fromEntries( + // eslint-disable-next-line + // @ts-ignore + items.map((item) => [item, defaultTheme?.[component]?.[item]]) + ) + : defaultTheme?.[component], + } return ( <>