diff options
| author | David Hill <[email protected]> | 2026-03-10 18:52:32 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-10 13:52:32 -0500 |
| commit | f77e5cf8fb9d9babcfc1b3ba046c0ba571489647 (patch) | |
| tree | d4424aac3e3bb6438e2af61050daefbdc2e7702b /packages/ui/src/components/card.css | |
| parent | e6cdc21f2ddd7264a75eb389693d4d62367ae38c (diff) | |
| download | opencode-f77e5cf8fb9d9babcfc1b3ba046c0ba571489647.tar.gz opencode-f77e5cf8fb9d9babcfc1b3ba046c0ba571489647.zip | |
feat(ui): restyle Card and improve tool error cards (#16888)
Co-authored-by: Adam <[email protected]>
Diffstat (limited to 'packages/ui/src/components/card.css')
| -rw-r--r-- | packages/ui/src/components/card.css | 109 |
1 files changed, 87 insertions, 22 deletions
diff --git a/packages/ui/src/components/card.css b/packages/ui/src/components/card.css index 6dae47223..2d482dba7 100644 --- a/packages/ui/src/components/card.css +++ b/packages/ui/src/components/card.css @@ -1,29 +1,94 @@ [data-component="card"] { + --card-pad-y: 10px; + --card-pad-r: 12px; + --card-pad-l: 10px; + width: 100%; display: flex; flex-direction: column; - background-color: var(--surface-inset-base); - border: 1px solid var(--border-weaker-base); - transition: background-color 0.15s ease; + position: relative; + background: transparent; + border: none; border-radius: var(--radius-md); - padding: 6px 12px; - overflow: clip; - - &[data-variant="error"] { - background-color: var(--surface-critical-weak); - border: 1px solid var(--border-critical-base); - color: rgba(218, 51, 25, 0.6); - - /* text-12-regular */ - font-family: var(--font-family-sans); - font-size: var(--font-size-small); - font-style: normal; - font-weight: var(--font-weight-regular); - line-height: var(--line-height-large); /* 166.667% */ - letter-spacing: var(--letter-spacing-normal); - - &[data-component="icon"] { - color: var(--icon-critical-active); - } + padding: var(--card-pad-y) var(--card-pad-r) var(--card-pad-y) var(--card-pad-l); + + /* text-14-regular */ + font-family: var(--font-family-sans); + font-size: var(--font-size-base); + font-style: normal; + font-weight: var(--font-weight-regular); + line-height: var(--line-height-large); + letter-spacing: var(--letter-spacing-normal); + color: var(--text-strong); + + --card-gap: 8px; + --card-icon: 16px; + --card-indent: 0px; + --card-line-pad: 8px; + + --card-accent: var(--icon-active); + + &:has([data-slot="card-title"]) { + gap: 8px; + } + + &:has([data-slot="card-title-icon"]) { + --card-indent: calc(var(--card-icon) + var(--card-gap)); + } + + &::before { + content: ""; + position: absolute; + left: 0; + top: var(--card-line-pad); + bottom: var(--card-line-pad); + width: 2px; + border-radius: 2px; + background-color: var(--card-accent); + } + + :where([data-card="title"], [data-slot="card-title"]) { + color: var(--text-strong); + font-weight: var(--font-weight-medium); + } + + :where([data-slot="card-title"]) { + display: flex; + align-items: center; + gap: var(--card-gap); + } + + :where([data-slot="card-title"]) [data-component="icon"] { + color: var(--card-accent); + } + + :where([data-slot="card-title-icon"]) { + display: inline-flex; + align-items: center; + justify-content: center; + width: var(--card-icon); + height: var(--card-icon); + flex: 0 0 auto; + } + + :where([data-slot="card-title-icon"][data-placeholder]) [data-component="icon"] { + color: var(--text-weak); + } + + :where([data-slot="card-title-icon"]) + [data-slot="icon-svg"] + :is(path, line, polyline, polygon, rect, circle, ellipse)[stroke] { + stroke-width: 1.5px !important; + } + + :where([data-card="description"], [data-slot="card-description"]) { + color: var(--text-base); + white-space: pre-wrap; + overflow-wrap: anywhere; + word-break: break-word; + } + + :where([data-card="actions"], [data-slot="card-actions"]) { + padding-left: var(--card-indent); } } |
