Download packages/tui/src/component/spinner.tsx from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 942 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/tui/src/component/spinner.tsx
- Command line
-
hf download hf://SaylorTwift/opencode/packages/tui/src/component/spinner.tsx
-
curl -L -o spinner.tsx https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/tui/src/component/spinner.tsx
942 Bytes
| import { Show } from "solid-js" | |
| import { useTheme } from "../context/theme" | |
| import { useKV } from "../context/kv" | |
| import type { JSX } from "@opentui/solid" | |
| import type { RGBA } from "@opentui/core" | |
| import { registerOpencodeSpinner } from "./register-spinner" | |
| registerOpencodeSpinner() | |
| export const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"] | |
| export function Spinner(props: { children?: JSX.Element; color?: RGBA }) { | |
| const { theme } = useTheme() | |
| const kv = useKV() | |
| const color = () => props.color ?? theme.textMuted | |
| return ( | |
| <Show when={kv.get("animations_enabled", true)} fallback={<text fg={color()}>⋯ {props.children}</text>}> | |
| <box flexDirection="row" gap={1}> | |
| <spinner frames={SPINNER_FRAMES} interval={80} color={color()} /> | |
| <Show when={props.children}> | |
| <text fg={color()}>{props.children}</text> | |
| </Show> | |
| </box> | |
| </Show> | |
| ) | |
| } | |