mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-19 00:03:13 +03:00
fix(tui): keep spinner glyph from shrinking beside long labels (#49395)
This commit is contained in:
committed by
GitHub
Unverified
parent
a72f988c90
commit
0ee5ef6c43
@@ -21,6 +21,8 @@ export function Spinner(props: { children?: JSX.Element; color?: RGBA; shimmer?:
|
||||
const timer = setInterval(() => setFrame((value) => (value + 1) % SPINNER_FRAMES.length), 80)
|
||||
onCleanup(() => clearInterval(timer))
|
||||
})
|
||||
// A bare spinner beside a long sibling shrinks to a fractional width that rounds to 0, so the
|
||||
// glyph paints on top of the row gap. Only a labeled spinner may shrink (to wrap its text).
|
||||
return (
|
||||
<Show
|
||||
when={config.animations ?? true}
|
||||
@@ -29,8 +31,10 @@ export function Spinner(props: { children?: JSX.Element; color?: RGBA; shimmer?:
|
||||
<Show
|
||||
when={props.shimmer}
|
||||
fallback={
|
||||
<box flexDirection="row" gap={1}>
|
||||
<spinner frames={SPINNER_FRAMES} interval={80} color={color()} />
|
||||
<box flexDirection="row" gap={1} flexShrink={props.children ? 1 : 0}>
|
||||
<box flexShrink={0}>
|
||||
<spinner frames={SPINNER_FRAMES} interval={80} color={color()} />
|
||||
</box>
|
||||
<Show when={props.children}>
|
||||
<text fg={color()}>{props.children}</text>
|
||||
</Show>
|
||||
|
||||
Reference in New Issue
Block a user