Skip to content

docs(homepage): let the developer experience example compose itself - #2829

Draft
Lisa18289 wants to merge 7 commits into
mainfrom
claude/github-issue-2824-5c53e2
Draft

docs(homepage): let the developer experience example compose itself#2829
Lisa18289 wants to merge 7 commits into
mainfrom
claude/github-issue-2824-5c53e2

Conversation

@Lisa18289

@Lisa18289 Lisa18289 commented Aug 11, 2026

Copy link
Copy Markdown
Member

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.

<Section>
  <Header>
    <Heading>Profil</Heading>
    <Button color="secondary" variant="soft">
      Bearbeiten
    </Button>
  </Header>
  <LabeledValue>
    <Label>E-Mail-Adresse</Label>
    <Content>max@mustermann.de</Content>
  </LabeledValue>
</Section>

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

  • Starts when the tile scrolls into view (IntersectionObserver, 30 %). The tile sits below the fold; otherwise the animation would be over before anyone sees it.
  • Nothing moves. The finished example is rendered server side; preview and code block each measure their final height on mount and hold it while typing, and the preview is top aligned during the run.
  • prefers-reduced-motion: the last step immediately, no animation.
  • Stays a live example. Focusing or clicking the editor jumps to the end and stops the animation; editing works as before.
  • transformCode keeps the last parsable preview instead of rendering a parser error while the code is half typed. This also applies to manual edits.

Implementation

page.tsx no longer builds the LiveProvider inline — 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:

  • Tile 430 px, preview 143 px, code block 285 px, first code line 161 px — every value constant, and the heading stays at its offset of 25 px from the moment it appears.
  • No horizontal scrolling in the code block at 1280 px, 1100 px or 390 px.
  • Off screen the finished example stays put; scrolling in restarts it at <Section></Section> and it completes.
  • Reduced motion keeps the complete example, on load and on scroll.
  • Clicking the editor mid-run jumps to the end; editing "Bearbeiten" afterwards updates the button in the preview.
  • Dark theme and 390 px width (no horizontal page overflow).

pnpm lint, prettier --check and tsc --noEmit pass.

🤖 Generated with Claude Code

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>
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for ./packages/components/

Status Category Percentage Covered / Total
🔵 Lines 75.59% 601 / 795
🔵 Statements 75.46% 615 / 815
🔵 Functions 77.97% 131 / 168
🔵 Branches 65.85% 272 / 413
File CoverageNo changed files found.
Generated in workflow #6088 for commit 8a88fc1 by the Vitest Coverage Report Action

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

Preview environments are ready:

Type URL
docs pr-2829.docs.review.flow-components.de
storybook pr-2829.storybook.review.flow-components.de

Images:

  • docs: ghcr.io/mittwald/flow/docs:pr-2829
  • storybook: ghcr.io/mittwald/flow/storybook:pr-2829

Lisa18289 and others added 6 commits August 11, 2026 08:41
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>
@Lisa18289 Lisa18289 self-assigned this Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(homepage): "Fokus auf Developer Experience" example doesn't demonstrate its own copy

1 participant