From f57e9470fe4f0cd0f3404f62078413eeee41e0db Mon Sep 17 00:00:00 2001 From: brunoschadeck Date: Tue, 30 Jul 2024 14:03:00 +0200 Subject: [PATCH] fix: adds optional codeFileName field to components example data --- showcases/react-showcase/src/components/data.ts | 5 ++++- showcases/shared/default-component-data.ts | 1 + showcases/shared/notification.json | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/showcases/react-showcase/src/components/data.ts b/showcases/react-showcase/src/components/data.ts index afe4c72d7e7..cd1333254ce 100644 --- a/showcases/react-showcase/src/components/data.ts +++ b/showcases/react-showcase/src/components/data.ts @@ -8,7 +8,10 @@ export const getVariants = ( ): ReactDefaultComponentVariants[] => defaultComponentVariants.map((variant, variantIndex) => ({ ...variant, - SlotCode: codeSlots?.[variant.name.replaceAll(' ', '')], + SlotCode: + codeSlots?.[ + variant.codeFileName ?? variant.name.replaceAll(' ', '') + ], examples: variant.examples.map((example, exampleIndex) => ({ ...example, example: getExample({ diff --git a/showcases/shared/default-component-data.ts b/showcases/shared/default-component-data.ts index fa6ef51300a..079039999c2 100644 --- a/showcases/shared/default-component-data.ts +++ b/showcases/shared/default-component-data.ts @@ -19,6 +19,7 @@ export type DefaultComponentExample = { export type DefaultComponentVariants = { name: string; + codeFileName?: string; children?: DefaultComponentExample[]; examples: DefaultComponentExample[]; color?: string; diff --git a/showcases/shared/notification.json b/showcases/shared/notification.json index fa98d48c78c..8f91d638231 100644 --- a/showcases/shared/notification.json +++ b/showcases/shared/notification.json @@ -155,6 +155,7 @@ }, { "name": "Content - Variant:Docked", + "codeFileName": "ContentVariantDocked", "examples": [ { "name": "Text", @@ -279,6 +280,7 @@ }, { "name": "Content - Variant:Standalone", + "codeFileName": "ContentVariantStandalone", "examples": [ { "name": "Text", @@ -411,6 +413,7 @@ }, { "name": "Content - Variant:Overlay", + "codeFileName": "ContentVariantOverlay", "examples": [ { "name": "Text",