diff options
| author | Adam <[email protected]> | 2026-02-12 07:16:30 -0600 |
|---|---|---|
| committer | Adam <[email protected]> | 2026-02-12 07:16:30 -0600 |
| commit | 5f421883a8aa92338bee1399532f359c5e986f41 (patch) | |
| tree | 52bf13cf30e6b6f9706475818528dca280d5b1e3 /packages/ui/src/components | |
| parent | fa97475ee82eaca292a72baa01d7da0ef1695f1b (diff) | |
| download | opencode-5f421883a8aa92338bee1399532f359c5e986f41.tar.gz opencode-5f421883a8aa92338bee1399532f359c5e986f41.zip | |
chore: style loading screen
Diffstat (limited to 'packages/ui/src/components')
| -rw-r--r-- | packages/ui/src/components/progress.css | 63 | ||||
| -rw-r--r-- | packages/ui/src/components/progress.tsx | 39 |
2 files changed, 102 insertions, 0 deletions
diff --git a/packages/ui/src/components/progress.css b/packages/ui/src/components/progress.css new file mode 100644 index 000000000..c728912f7 --- /dev/null +++ b/packages/ui/src/components/progress.css @@ -0,0 +1,63 @@ +[data-component="progress"] { + display: flex; + flex-direction: column; + gap: 4px; + + [data-slot="progress-header"] { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; + } + + [data-slot="progress-label"], + [data-slot="progress-value-label"] { + font-family: var(--font-family-sans); + font-size: var(--font-size-small); + font-weight: var(--font-weight-regular); + line-height: var(--line-height-large); + letter-spacing: var(--letter-spacing-normal); + } + + [data-slot="progress-label"] { + color: var(--text-base); + } + + [data-slot="progress-value-label"] { + color: var(--text-weak); + font-variant-numeric: tabular-nums; + } + + [data-slot="progress-track"] { + position: relative; + width: 100%; + height: 8px; + overflow: hidden; + border-radius: 999px; + border: 1px solid var(--border-weak-base); + background-color: var(--surface-base); + } + + [data-slot="progress-fill"] { + height: 100%; + width: var(--kb-progress-fill-width); + border-radius: inherit; + background-color: var(--border-active); + transition: width 200ms ease; + } + + &[data-indeterminate] [data-slot="progress-fill"] { + width: 35%; + animation: progress-indeterminate 1.3s ease-in-out infinite; + } +} + +@keyframes progress-indeterminate { + from { + transform: translateX(-100%); + } + + to { + transform: translateX(300%); + } +} diff --git a/packages/ui/src/components/progress.tsx b/packages/ui/src/components/progress.tsx new file mode 100644 index 000000000..bfe10a1d1 --- /dev/null +++ b/packages/ui/src/components/progress.tsx @@ -0,0 +1,39 @@ +import { Progress as Kobalte } from "@kobalte/core/progress" +import { Show, splitProps } from "solid-js" +import type { ComponentProps, ParentProps } from "solid-js" + +export interface ProgressProps extends ParentProps<ComponentProps<typeof Kobalte>> { + hideLabel?: boolean + showValueLabel?: boolean +} + +export function Progress(props: ProgressProps) { + const [local, others] = splitProps(props, ["children", "class", "classList", "hideLabel", "showValueLabel"]) + + return ( + <Kobalte + {...others} + data-component="progress" + classList={{ + ...(local.classList ?? {}), + [local.class ?? ""]: !!local.class, + }} + > + <Show when={local.children || local.showValueLabel}> + <div data-slot="progress-header"> + <Show when={local.children}> + <Kobalte.Label data-slot="progress-label" classList={{ "sr-only": local.hideLabel }}> + {local.children} + </Kobalte.Label> + </Show> + <Show when={local.showValueLabel}> + <Kobalte.ValueLabel data-slot="progress-value-label" /> + </Show> + </div> + </Show> + <Kobalte.Track data-slot="progress-track"> + <Kobalte.Fill data-slot="progress-fill" /> + </Kobalte.Track> + </Kobalte> + ) +} |
