feat(demos): standardize the Demo embed contract on demoHeight - #90
Merged
Conversation
Default the Demo component's heightKey to "demoHeight" and migrate the three existing demos (raf-pipeline, yield-pipeline, network-waterfall) to post it. This fixes auto-height for yield-pipeline and network-waterfall, which posted keys that never matched the old "rafDemoHeight" default and were stuck at the 400px minimum. Name the height padding constant, add an always-visible "Open demo in a new tab" fallback link, and document the authoring contract (height reporting, theme sync, self-contained) with a copyable template in public/demos/README.md.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
What
Standardizes the interactive-demo embed contract so new demos are trivial to author and existing ones size correctly.
<Demo>component'sheightKeytodemoHeight(falls back todemoHeightregardless of the prop).demoHeight.public/demos/README.md.Why
The three demos each posted a unique height key (
rafDemoHeight,yieldDemoHeight,netWaterfallHeight) but no page passedheightKey, so onlyraf-pipelinematched the old default.yield-pipelineandnetwork-waterfallwere stuck at the 400px minimum, their real height never applied.Verification (runtime,
next dev)Also verified: dynamic auto-height via ResizeObserver (added 300px to the demo body → iframe grew by 314, reverted exactly on removal), light↔dark theme sync, and the fallback link renders with the correct href.