Skip to content

Commit

Permalink
Merge pull request #2936 from db-ui/fix-show-code-button-partly-missing
Browse files Browse the repository at this point in the history
fix: adds optional codeFileName field to components example data
  • Loading branch information
bruno-sch authored Jul 30, 2024
2 parents 807fdfa + f57e947 commit 06e9211
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion showcases/react-showcase/src/components/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
1 change: 1 addition & 0 deletions showcases/shared/default-component-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type DefaultComponentExample = {

export type DefaultComponentVariants = {
name: string;
codeFileName?: string;
children?: DefaultComponentExample[];
examples: DefaultComponentExample[];
color?: string;
Expand Down
3 changes: 3 additions & 0 deletions showcases/shared/notification.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
},
{
"name": "Content - Variant:Docked",
"codeFileName": "ContentVariantDocked",
"examples": [
{
"name": "Text",
Expand Down Expand Up @@ -279,6 +280,7 @@
},
{
"name": "Content - Variant:Standalone",
"codeFileName": "ContentVariantStandalone",
"examples": [
{
"name": "Text",
Expand Down Expand Up @@ -411,6 +413,7 @@
},
{
"name": "Content - Variant:Overlay",
"codeFileName": "ContentVariantOverlay",
"examples": [
{
"name": "Text",
Expand Down

0 comments on commit 06e9211

Please sign in to comment.