Skip to content

fix(web): bento copy button size + leading whitespace in code blocks#25

Merged
lukeocodes merged 1 commit intomainfrom
web/bento-button-and-whitespace
May 5, 2026
Merged

fix(web): bento copy button size + leading whitespace in code blocks#25
lukeocodes merged 1 commit intomainfrom
web/bento-button-and-whitespace

Conversation

@lukeocodes
Copy link
Copy Markdown
Member

Fixes the leading-whitespace bug (JSX source indent leaking into white-space: pre) and the oversized copy button on the bento step cards.

  • Code box is now a flex container with a child for the text and a sibling button.
  • Button drops the hover background, uses smaller padding, sits in the row's flow rather than absolute-positioned.
  • Container is on a single source line so JSX whitespace stops leaking.

Two related issues from the registry-model bento section:

1. Leading whitespace on the first line of every code block. The
   Astro source had {code} and <button> on separate lines inside a
   div with white-space: pre, so the JSX source indentation between
   them rendered as visible leading whitespace before the first line
   of code.

2. Copy button looked oversized on tighter rows. The previous
   implementation used absolute positioning with hover background,
   which made it dominate the small code box.

Restructured the code box as a flex row of two siblings: a <code>
element holding the snippet (still white-space: pre), and the copy
button as a separate flex item with no absolute positioning and no
hover background. The whole container is on one source line so JSX
formatting whitespace stops leaking into the rendered output.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ui-web Ready Ready Preview, Comment May 5, 2026 7:19pm

Request Review

@lukeocodes lukeocodes merged commit d616c38 into main May 5, 2026
3 checks passed
@lukeocodes lukeocodes deleted the web/bento-button-and-whitespace branch May 5, 2026 19:20
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.

1 participant