docs(homepage): let the developer experience example compose itself - #2829
Draft
Lisa18289 wants to merge 7 commits into
Draft
docs(homepage): let the developer experience example compose itself#2829Lisa18289 wants to merge 7 commits into
Lisa18289 wants to merge 7 commits into
Conversation
The "Fokus auf Developer Experience" tile claimed nested components, automatic spacing and design system conformance while showing a single plain Button. None of the three was visible. The example is now a Section with Heading, Text and an ActionGroup, and it types itself into the editor one nested layer at a time — the live preview snaps into place with the right spacing on every step. That also ties the tile to its "Zu den Components" link, which points at action-group. - Starts when the tile scrolls into view; it sits below the fold. - Renders the finished example server side, measures its height and holds it while typing, so the page never shifts. - Respects prefers-reduced-motion: the last step, no animation. - Focusing the editor jumps to the end; the example stays editable. - transformCode keeps the last parsable preview instead of rendering a parser error while code is half typed (or half edited). Closes #2824 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Coverage Report for ./packages/components/
File CoverageNo changed files found. |
Contributor
🚀 Preview DeploymentPreview environments are ready:
Images:
|
Only the wrapper's height was reserved, so the page stayed still while the tile's insides kept moving: the preview was centred and drifted upwards as the code block grew underneath it. Preview and code block now each hold their own final height, and the preview is top aligned while typing — the heading stays exactly where it appears. The example is now the app details of the Anlegeprozess pattern: Section > Heading, LabeledValue > Label + InlineCode, ActionGroup > two Buttons. That is one nesting level more than the previous version, and each layer brings its own automatic spacing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Five lines less: one Button instead of an ActionGroup with two, and it sits in the Section's Header, where the layout pushes it to the opposite end of the heading. Section > Header > Heading + Button and LabeledValue > Label + InlineCode still show the nesting and the automatic spacing the tile talks about. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Spelled out, the import of seven components took more room than the composition it enabled — the tile grew to 649 px for ten lines of actual example. The editor now shows the composition alone and the tile is back to 389 px. The scope still comes from a real import statement, just one the reader never sees. Without the import steps the animation is three steps instead of five, so the typing speed goes back up a notch. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The WordPress app details spoke to hosting customers only. A profile section — heading, an edit action in the header, e-mail as a labeled value — is something every reader recognises, and it shows the same nesting: Section > Header > Heading + Button and LabeledValue > Label + Content. The action is wrapped the way Prettier wraps it in the styleguide's own examples. As a single line it ended flush against the right edge of the code block and started scrolling below 1280 px. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The heading was already there when the animation started, so the first thing the reader saw was a finished-looking component. It now starts at `<Section></Section>` and every component in the example — Header, Heading, LabeledValue, Button — gets typed in front of them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Dropped the ones that restate their own code: the TypedCode members, the insertsWholeLines and getInsertion headers, and the two component descriptions. What is left names something the reader cannot see from the file — the paint timing behind the synchronous first frame, the single-insertion invariant useTypedCode relies on, the centred preview in the shared stylesheet, and why the heights are taken by class lookup. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2824
The "Fokus auf Developer Experience" tile claimed nested components, automatic spacing and design system conformance while showing a single plain
Button. None of the three was visible.The example is now a profile section that composes itself from the bare
<Section>— Header with its heading, then the labeled value, then the action. Every added layer snaps into place with the right spacing, and the header pushes its action to the opposite end on its own. That also ties the tile to its "Zu den Components" link.The editor shows the composition without its import — spelled out, seven component names take more room than the example itself. The editor scope comes from a real import statement in
codeSteps.ts, just one the reader never sees.How it behaves
prefers-reduced-motion: the last step immediately, no animation.transformCodekeeps the last parsable preview instead of rendering a parser error while the code is half typed. This also applies to manual edits.Implementation
page.tsxno longer builds theLiveProviderinline — it renders<HomeCodeExample />, which keeps the animation's re-renders out of the page component.codeSteps.ts— the four steps plus the import statement the scope is derived from. Each step inserts one block at a single position, inside<Header>or<Section>. That is what makes typing the difference between two steps possible.useTypedCode.ts— describes step n+1 as one insertion into step n, expands it into frames and drives them with a timer chain. Insertions are normalised to whole lines, so a new block is typed on its own line instead of growing out of the line below it.HomeCodeExample.tsx— editor, height reservation, visibility trigger.Verified
Driven with Playwright against
pnpm nx dev docs, sampled every 400 ms across the whole run:<Section></Section>and it completes.pnpm lint,prettier --checkandtsc --noEmitpass.🤖 Generated with Claude Code