Skip to content

Commit e5b8ecf

Browse files
leapegithub-actions[bot]nmerget
authored
feature(components): react playgrounds (modular react architecture) (#228)
* docs(beta-components): remove Component Playground sections from documentation * auto update snapshots (#220) Co-authored-by: Lea Perchermeier <lea.perchermeier@deutschebahn.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * refactor(stable-components): remove Component Playground sections from documentation - Remove ComponentPlayground import statements from all component documentation files - Delete Playground sections and interactive component examples from badge, button, checkbox, drawer, header, infotext, input, link, navigation-item, navigation, notification, radio, select, switch, tag, textarea, and tooltip component pages * docs(components): remove unused component imports from documentation - Remove unused component imports (DBAccordion, DBAccordionItem, DBBadge, DBButton, DBCard, DBCheckbox, DBCustomSelect, DBDivider, DBInput, DBLink, DBNavigation, DBNavigationItem) from 18 component documentation files - Keep only DBSection import which is actively used in documentation pages - Reduce import clutter and improve code clarity across component guides * docs(components): remove unused component imports and configs - Remove CollapseButton and CollapsibleWrapper imports from accordion, card, custom-select, divider, popover, and section documentation - Remove PropertiesTable imports from accordion, card, custom-select, divider, popover, and section documentation - Remove component config imports (accordionConfig, backdropConfig, cardConfig, customSelectConfig, dividerConfig, popoverConfig, sectionConfig, stackConfig) from all affected component pages - Clean up documentation files to remove references to deprecated Component Playground functionality * feat(components): add ComponentPlayground system and integrate into documentation - Create ComponentPlayground component system with interactive controls (CheckboxControl, SelectControl, TextControl) - Add ComponentPlaygroundWrapper.astro for seamless Astro integration - Implement dependency-engine.ts for managing component prop dependencies - Add playground-init.ts and component-registry.ts for initialization and component mapping - Add PlaygroundDebug.tsx and PreviewArea.tsx for debugging and preview functionality - Integrate ComponentPlayground into all component documentation pages (badge, button, checkbox, drawer, header, infotext, input, link, navigation, notification, radio, select, switch, tag, textarea, tooltip) - Update component config files to support playground functionality - Remove order frontmatter from component documentation pages - Add status field to drawer component documentation - Update .gitignore to exclude .kiro directory - Update DocumentationLayout.astro to support new playground system * chore: update ComponentPlayground.tsx to work properly with configs * chore: update package.json * auto update snapshots (#271) Co-authored-by: Lea Perchermeier <lea.perchermeier@deutschebahn.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * chore: update all playgrounds * auto update snapshots (#274) Co-authored-by: Lea Perchermeier <lea.perchermeier@deutschebahn.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * docs: update CONTRIBUTING.md with environment setup instructions --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Nicolas Merget <nicolas.merget@deutschebahn.com>
1 parent 6c76805 commit e5b8ecf

File tree

124 files changed

+3088
-5429
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+3088
-5429
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ pnpm-debug.log*
1717
.DS_Store
1818
# jetbrains setting folder
1919
.idea/
20-
20+
# kiro
21+
.kiro
2122
**/*/.env
2223
/playwright-report
2324
/tests/**/*-win32.png

CONTRIBUTING.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ We are committed to fostering a welcoming, respectful, and harassment-free envir
66

77
## Prepare
88

9-
_tbd_
9+
Get credentials for public usage from [Marketingportal](https://marketingportal.extranet.deutschebahn.com/marketingportal/Design-Anwendungen/db-ux-design-system/resources/db-theme) and add them to your [`.env` File](./.env) - see [`.env.template`](./.env.template).
10+
11+
```shell
12+
pnpm install
13+
# it should run postinstall tasks from @db-ux/db-theme* by default, if not:
14+
# execute this tasks manually to decode the assets using the previously made setup:
15+
pnpm run decode-db-theme-assets
16+
```
1017

1118
## Start locally
1219

content/pages/documentation/components/accordion.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import GuidelineExample from '@template/components/GuidelineExample/GuidelineExa
1414
import ResourceCards from '@template/components/ResourceCards/ResourceCards.astro';
1515
import TeaserCard from '@template/components/TeaserCard/TeaserCard.astro';
1616
import QuestionForm from '@template/components/QuestionForm/QuestionForm.astro';
17+
import ComponentPlayground from '@template/components/ComponentPlayground/ComponentPlaygroundWrapper.astro';
1718

1819
Accordions group content into collapsible sections to save space and let users reveal details progressively. It is best for optional information and structured content where users do not need to see everything at once.
1920

@@ -29,6 +30,14 @@ Accordions group content into collapsible sections to save space and let users r
2930

3031
</DBSection>
3132

33+
<DBSection spacing="small" width="auto">
34+
35+
## Playground
36+
37+
<ComponentPlayground component="accordion" />
38+
39+
</DBSection>
40+
3241
<DBSection spacing="small" width="auto">
3342

3443
## Usage Hints

content/pages/documentation/components/badge.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import ResourceCards from '@template/components/ResourceCards/ResourceCards.astr
1818
import TeaserCard from '@template/components/TeaserCard/TeaserCard.astro';
1919
import QuestionForm from '@template/components/QuestionForm/QuestionForm.astro';
2020

21-
import { badgeConfig } from '@template/configs/badge.config.js';
21+
import ComponentPlayground from '@template/components/ComponentPlayground/ComponentPlaygroundWrapper.astro';
2222

2323
- Indicate status or state of an item (e.g. new, error, success)
2424
- Label or categorize content with a short descriptor
@@ -34,6 +34,14 @@ import { badgeConfig } from '@template/configs/badge.config.js';
3434

3535
<DBSection spacing="small" width="auto">
3636

37+
## Playground
38+
39+
<ComponentPlayground component="badge" />
40+
41+
</DBSection>
42+
43+
<DBSection spacing="small" width="auto">
44+
3745
## Guidelines
3846

3947
<CollapsibleWrapper collapsedHeight="320px">

content/pages/documentation/components/button.mdx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import ResourceCards from '@template/components/ResourceCards/ResourceCards.astr
1818
import TeaserCard from '@template/components/TeaserCard/TeaserCard.astro';
1919
import QuestionForm from '@template/components/QuestionForm/QuestionForm.astro';
2020

21-
import { buttonConfig } from '@template/configs/button.config.js';
21+
import ComponentPlayground from '@template/components/ComponentPlayground/ComponentPlaygroundWrapper.astro';
2222

2323
- Trigger an action (e.g., Send, Save, Delete)
2424
- Indicate that interaction or confirmation is expected
@@ -34,6 +34,14 @@ import { buttonConfig } from '@template/configs/button.config.js';
3434

3535
<DBSection spacing="small" width="auto">
3636

37+
## Playground
38+
39+
<ComponentPlayground component="button" />
40+
41+
</DBSection>
42+
43+
<DBSection spacing="small" width="auto">
44+
3745
## Guidelines
3846

3947
<CollapsibleWrapper collapsedHeight="320px">
@@ -150,6 +158,8 @@ The small button in functional density has a height of 20 px. To meet accessibil
150158

151159
## FAQ
152160

161+
Have a question about the Button component? We'll answer it and add frequently asked questions to this page.
162+
153163
<QuestionForm componentName="Button" />
154164

155165
</DBSection>

content/pages/documentation/components/card.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import GuidelineExample from '@template/components/GuidelineExample/GuidelineExa
1414
import ResourceCards from '@template/components/ResourceCards/ResourceCards.astro';
1515
import TeaserCard from '@template/components/TeaserCard/TeaserCard.astro';
1616
import QuestionForm from '@template/components/QuestionForm/QuestionForm.astro';
17+
import ComponentPlayground from '@template/components/ComponentPlayground/ComponentPlaygroundWrapper.astro';
1718

1819
Cards group related content into a contained surface to improve scanning and create clear visual structure. They can be static for content grouping or interactive as an entry point to deeper content, but should stay simple and consistent.
1920

@@ -29,6 +30,14 @@ Cards group related content into a contained surface to improve scanning and cre
2930

3031
</DBSection>
3132

33+
<DBSection spacing="small" width="auto">
34+
35+
## Playground
36+
37+
<ComponentPlayground component="card" />
38+
39+
</DBSection>
40+
3241
<DBSection spacing="small" width="auto">
3342

3443
## Usage Hints
@@ -124,6 +133,8 @@ If the card is interactive, it must be keyboard reachable and expose correct sem
124133

125134
## FAQ
126135

136+
Have a question about the card component? We'll answer it and add frequently asked questions to this page.
137+
127138
<QuestionForm componentName="Card" />
128139

129140
</DBSection>

content/pages/documentation/components/checkbox.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import ResourceCards from '@template/components/ResourceCards/ResourceCards.astr
1818
import TeaserCard from '@template/components/TeaserCard/TeaserCard.astro';
1919
import QuestionForm from '@template/components/QuestionForm/QuestionForm.astro';
2020

21-
import { checkboxConfig } from '@template/configs/checkbox.config.js';
21+
import ComponentPlayground from '@template/components/ComponentPlayground/ComponentPlaygroundWrapper.astro';
2222

2323
- Select multiple options from a list (e.g., notification channels)
2424
- Confirm consent or acknowledgment (e.g., accept terms)
@@ -34,6 +34,14 @@ import { checkboxConfig } from '@template/configs/checkbox.config.js';
3434

3535
<DBSection spacing="small" width="auto">
3636

37+
## Playground
38+
39+
<ComponentPlayground component="checkbox" />
40+
41+
</DBSection>
42+
43+
<DBSection spacing="small" width="auto">
44+
3745
## Guidelines
3846

3947
<CollapsibleWrapper collapsedHeight="320px">

content/pages/documentation/components/custom-select.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import GuidelineExample from '@template/components/GuidelineExample/GuidelineExa
1414
import ResourceCards from '@template/components/ResourceCards/ResourceCards.astro';
1515
import TeaserCard from '@template/components/TeaserCard/TeaserCard.astro';
1616
import QuestionForm from '@template/components/QuestionForm/QuestionForm.astro';
17+
import ComponentPlayground from '@template/components/ComponentPlayground/ComponentPlaygroundWrapper.astro';
1718

1819
Custom Select is an advanced dropdown for choosing one or multiple predefined options with support for search, grouping, and showing selected values. Use it when a basic select is not sufficient due to option volume, selection complexity, or the need for better scanning and management of chosen items.
1920

@@ -29,6 +30,14 @@ Custom Select is an advanced dropdown for choosing one or multiple predefined op
2930

3031
</DBSection>
3132

33+
<DBSection spacing="small" width="auto">
34+
35+
## Playground
36+
37+
<ComponentPlayground component="customSelect" />
38+
39+
</DBSection>
40+
3241
<DBSection spacing="small" width="auto">
3342

3443
## Usage Hints
@@ -124,6 +133,8 @@ Enable search when the list is long or users know what they want. Use grouping o
124133

125134
## FAQ
126135

136+
Have a question about the custom select component? We'll answer it and add frequently asked questions to this page.
137+
127138
<QuestionForm componentName="Custom Select" />
128139

129140
</DBSection>

content/pages/documentation/components/divider.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import GuidelineExample from '@template/components/GuidelineExample/GuidelineExa
1414
import ResourceCards from '@template/components/ResourceCards/ResourceCards.astro';
1515
import TeaserCard from '@template/components/TeaserCard/TeaserCard.astro';
1616
import QuestionForm from '@template/components/QuestionForm/QuestionForm.astro';
17+
import ComponentPlayground from '@template/components/ComponentPlayground/ComponentPlaygroundWrapper.astro';
1718

1819
Divider is a thin horizontal or vertical line that separates UI elements into logical sections and improves layout clarity. It should be used sparingly and together with spacing and hierarchy to avoid visual clutter.
1920

@@ -29,6 +30,14 @@ Divider is a thin horizontal or vertical line that separates UI elements into lo
2930

3031
</DBSection>
3132

33+
<DBSection spacing="small" width="auto">
34+
35+
## Playground
36+
37+
<ComponentPlayground component="divider" />
38+
39+
</DBSection>
40+
3241
<DBSection spacing="small" width="auto">
3342

3443
## Usage Hints
@@ -90,6 +99,8 @@ Align dividers to the content container and grid. Avoid partial or "floating" di
9099

91100
## FAQ
92101

102+
Have a question about the divider component? We'll answer it and add frequently asked questions to this page.
103+
93104
<QuestionForm componentName="Divider" />
94105

95106
</DBSection>

content/pages/documentation/components/drawer.mdx

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ headline: 'Drawer'
66
title: 'Drawer'
77
description: 'Drawer is a sliding panel that appears from the side, top, or bottom to show supplemental content or lightweight interactions while keeping the user in context. It is ideal for optional details and simple tasks, and must always be easy to dismiss.'
88
align: start
9-
status: 'stable'
109
toc: true
10+
status: 'stable'
1111
---
1212

1313
import { DBSection } from '@db-ux/react-core-components';
@@ -17,7 +17,7 @@ import GuidelineExample from '@template/components/GuidelineExample/GuidelineExa
1717
import ResourceCards from '@template/components/ResourceCards/ResourceCards.astro';
1818
import TeaserCard from '@template/components/TeaserCard/TeaserCard.astro';
1919
import QuestionForm from '@template/components/QuestionForm/QuestionForm.astro';
20-
import { drawerConfig } from '@template/configs/drawer.config.js';
20+
import ComponentPlayground from '@template/components/ComponentPlayground/ComponentPlaygroundWrapper.astro';
2121

2222
- Show additional details or secondary information without leaving the current page
2323
- Provide simple, optional form inputs or quick edits in context
@@ -27,7 +27,42 @@ import { drawerConfig } from '@template/configs/drawer.config.js';
2727

2828
## Resources
2929

30-
<ResourceCards path="?path=/docs/components-dbdrawer-density--docs" />
30+
<ResourceCards
31+
resources={[
32+
{
33+
title: 'React',
34+
description: 'TBD',
35+
url: '#',
36+
icon: 'react',
37+
},
38+
{
39+
title: 'Vue',
40+
description: 'TBD',
41+
url: '#',
42+
icon: 'vue',
43+
},
44+
{
45+
title: 'Angular',
46+
description: 'TBD',
47+
url: '#',
48+
icon: 'angular',
49+
},
50+
{
51+
title: 'Web Components',
52+
description: 'TBD',
53+
url: '#',
54+
icon: 'html5',
55+
},
56+
]}
57+
/>
58+
59+
</DBSection>
60+
61+
<DBSection spacing="small" width="auto">
62+
63+
## Playground
64+
65+
<ComponentPlayground component="drawer" />
3166

3267
</DBSection>
3368

@@ -115,6 +150,8 @@ Always provide a way to close the drawer, such as clicking outside the drawer ar
115150

116151
## FAQ
117152

153+
Have a question about the Drawer component? We'll answer it and add frequently asked questions to this page.
154+
118155
<QuestionForm componentName="Drawer" />
119156

120157
</DBSection>

0 commit comments

Comments
 (0)