-
Notifications
You must be signed in to change notification settings - Fork 14
feat: add mitosis examples to generate storybook files next to showcase examples #5387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
# Conflicts: # showcases/angular-showcase/src/app/components/button/button.component.html # showcases/shared/button.json
# Conflicts: # showcases/patternhub/tsconfig.json
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the showcase architecture to use Mitosis-based examples that can generate both showcase and Storybook files. The key change is moving from JSON-based configuration files to .lite.tsx example files that are compiled to framework-specific code, establishing a single source of truth for component examples across showcases and Storybooks.
Key Changes
- Introduces Mitosis-based showcase architecture with
.lite.tsxexample files for the Button component - Adds path alias configuration (
@components) across all showcase projects for cleaner imports - Removes JSON-based configuration (
showcases/shared/button.json) in favor of TypeScript example files - Creates reusable showcase wrapper components for consistent presentation across platforms
Reviewed changes
Copilot reviewed 95 out of 113 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
packages/components/src/components/button/showcase/button.showcase.lite.tsx |
New main showcase component for Button using Mitosis |
packages/components/src/components/button/examples/*.lite.tsx |
Individual example components for each Button variant/property |
packages/components/src/components/button/examples/button.examples.meta.ts |
Metadata defining all button examples with IDs and grouping |
packages/components/src/shared/showcase/*.lite.tsx |
Reusable wrapper components for showcase presentation |
packages/components/configs/mitosis.showcase.config.cjs |
New Mitosis configuration for compiling showcase files |
showcases/shared/showcase-plugins.tsx |
Plugin system for registering and retrieving showcase components |
showcases/*/tsconfig.json |
Path alias configuration for @components across all showcases |
showcases/*/vite.config.ts |
Vite alias configuration for @components |
storybooks/react-storybook/src/stories/Variant.stories.tsx |
Updated to use actual DBButton component |
showcases/patternhub/scripts/generate-docs-mdx.js |
Removed old code generation logic |
output/*/tsconfig.json |
Excludes showcase/example files from compilation |
__snapshots__/button/showcase/**/*.yaml |
Updated snapshots reflecting reordered examples |
...on/showcase/chromium/DBButton-should-match-screenshot-1/DBButton-should-match-screenshot.png
Show resolved
Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michaelmkraus these seem to be middle instead of bottom aligned so some elements are now positioned centered instead of block-end. Is this expected and should have happened like this with this PR ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that change is not intentional.
The centered vs. block-end alignment in the snapshot looks like an unintended side effect, likely coming from a shared wrapper that DBInput also uses. I’ll double-check the affected CSS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found the relevant CSS and reverted it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen your revert and even also the regenerated screenshots with commit c45938e. Now they are all top-aligned, but some of those seem to have been middle aligned, as still some screenshots show differences to the previous state of those reference screenshots …
...tack/showcase/chromium/DBStack-should-match-screenshot-1/DBStack-should-match-screenshot.png
Show resolved
Hide resolved
|
@michaelmkraus could you please add a description to this PR ? Why we did this change, on the expected outcome and a summary of the changes as well as what we need to do differently (in our processes) afterwards. |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen your revert and even also the regenerated screenshots with commit c45938e. Now they are all top-aligned, but some of those seem to have been middle aligned, as still some screenshots show differences to the previous state of those reference screenshots …
packages/components/src/shared/showcase/card-wrapper.showcase.lite.tsx
Outdated
Show resolved
Hide resolved
packages/components/src/shared/showcase/container-wrapper.showcase.lite.tsx
Outdated
Show resolved
Hide resolved
| .filter( | ||
| (branch) => | ||
| branch !== 'gh-pages' && !branch.includes('dependabot') | ||
| try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what for do we need this try / catch here ? The commit message only states "fix: issue with version-switcher.tsx".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the try-catch is used to catch errors in the async calls. Right now, the errors are only logged. Later, we should handle the error instead of failing silently.
…case.lite.tsx feat: use header instead of div as wrapper Co-authored-by: Maximilian Franzke <787658+mfranzke@users.noreply.github.com>
chore: add TODO comment so we do not forget do re-enable the code link. Co-authored-by: Maximilian Franzke <787658+mfranzke@users.noreply.github.com>
Proposed changes
The goal of this PR is to centralize all example definitions in Mitosis and automatically generate showcase outputs for all targets (React, Angular, Vue, Patternhub).
The PR provides
*.examples.meta.tsthat represents a typed metadata file for all examples, including identifiers, display names, grouping, and Storybook mappings)*.showcase.lite.tsxcomponents that consume the metadata, generate the corresponding React, Angular, and Vue showcase files and ensures a consistent structure across all frameworks)Types of changes
Further comments
🔭🐙🐈 Test this branch here: https://design-system.deutschebahn.com/core-web/review/feat-examples-plugins