fix(docsite): give ChatComposerInput block examples a definite width#4012
Open
ernestt wants to merge 1 commit into
Open
fix(docsite): give ChatComposerInput block examples a definite width#4012ernestt wants to merge 1 commit into
ernestt wants to merge 1 commit into
Conversation
The block examples render inside the docsite's centered preview, whose inner wrapper sizes to fit-content. A child styled width:100% has no definite width to resolve against there, so it collapses to the block's max-content width. For the bare ChatComposerInput examples that content is just an empty contentEditable plus the send button, so the composer rendered visibly squished instead of at its intended 450px. Swap width:100%/maxWidth:450 for width:450/maxWidth:100% so the preview wrapper honors a concrete 450px while the block still shrinks below that on narrow viewports.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
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.
Problem
On the
ChatComposerInputcomponent page, the block examples render noticeably squished — the composer collapses to a narrow column instead of the intended ~450px, unlike the neighboringChatComposerexamples.Root cause
The docsite preview (
ExampleBlock→LivePreview) centers each block in a flex row whose inner wrapper ismin-width: fit-content. A child styledwidth: 100%has no definite width to resolve against inside a shrink-wrapping parent, so it collapses to the block's max-content width, and themaxWidth: 450cap never engages.For the bare
ChatComposerInputexamples, the intrinsic content is just an emptycontentEditable(its placeholder isposition: absolute, so it doesn't contribute width) plus the send button — so max-content is tiny and the composer renders squished. TheChatComposerexamples that carry wider content (footer text, labeled buttons) happen to push max-content out to ~450, which is why they look fine.Fix
Swap
width: '100%', maxWidth: 450forwidth: 450, maxWidth: '100%'on the sixChatComposerInputblock wrappers. A definite width is honored by the fit-content preview wrapper, whilemaxWidth: 100%keeps the block responsive on narrow viewports.Files:
ChatComposerInputShowcase.tsxChatComposerInputControlledInput.tsxChatComposerInputDisabled.tsxChatComposerInputMentionTrigger.tsxChatComposerInputMultipleTriggers.tsxChatComposerInputSlashCommands.tsxNo component/API changes — demo blocks only.