fix(app): copy buttons smaller and out of the way

This commit is contained in:
Adam
2026-02-05 07:02:31 -06:00
parent ef09dddaa5
commit 05529f66d7
7 changed files with 33 additions and 17 deletions

View File

@@ -120,6 +120,11 @@
gap: calc(var(--spacing) * 0.5);
}
&[data-size="small"] {
width: 20px;
height: 20px;
}
&[data-size="large"] {
height: 32px;
/* padding: 0 8px 0 6px; */

View File

@@ -4,7 +4,7 @@ import { Icon, IconProps } from "./icon"
export interface IconButtonProps extends ComponentProps<typeof Kobalte> {
icon: IconProps["name"]
size?: "normal" | "large"
size?: "small" | "normal" | "large"
iconSize?: IconProps["size"]
variant?: "primary" | "secondary" | "ghost"
}

View File

@@ -69,7 +69,7 @@ function createCopyButton(labels: CopyLabels) {
button.type = "button"
button.setAttribute("data-component", "icon-button")
button.setAttribute("data-variant", "secondary")
button.setAttribute("data-size", "normal")
button.setAttribute("data-size", "small")
button.setAttribute("data-slot", "markdown-copy-button")
button.setAttribute("aria-label", labels.copy)
button.setAttribute("title", labels.copy)

View File

@@ -121,7 +121,7 @@
[data-slot="text-part-copy-wrapper"] {
position: absolute;
top: 8px;
top: -28px;
right: 8px;
opacity: 0;
transition: opacity 0.15s ease;

View File

@@ -425,6 +425,7 @@ export function UserMessageDisplay(props: { message: UserMessage; parts: PartTyp
>
<IconButton
icon={copied() ? "check" : "copy"}
size="small"
variant="secondary"
onMouseDown={(e) => e.preventDefault()}
onClick={(event) => {
@@ -694,6 +695,7 @@ PART_MAPPING["text"] = function TextPartDisplay(props) {
>
<IconButton
icon={copied() ? "check" : "copy"}
size="small"
variant="secondary"
onMouseDown={(e) => e.preventDefault()}
onClick={handleCopy}

View File

@@ -219,22 +219,28 @@
gap: 4px;
align-self: stretch;
[data-slot="session-turn-summary-title-row"] {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
[data-slot="session-turn-response"] {
position: relative;
width: 100%;
}
[data-slot="session-turn-response-copy-wrapper"] {
position: absolute;
top: 8px;
right: 8px;
opacity: 0;
pointer-events: none;
transition: opacity 0.15s ease;
z-index: 1;
}
[data-slot="session-turn-response"]:hover [data-slot="session-turn-response-copy-wrapper"] {
&:hover [data-slot="session-turn-response-copy-wrapper"],
&:focus-within [data-slot="session-turn-response-copy-wrapper"] {
opacity: 1;
pointer-events: auto;
}
p {

View File

@@ -702,14 +702,8 @@ export function SessionTurn(
<Show when={!working() && response()}>
<div data-slot="session-turn-summary-section">
<div data-slot="session-turn-summary-header">
<h2 data-slot="session-turn-summary-title">{i18n.t("ui.sessionTurn.summary.response")}</h2>
<div data-slot="session-turn-response">
<Markdown
data-slot="session-turn-markdown"
data-diffs={hasDiffs()}
text={response() ?? ""}
cacheKey={responsePartId()}
/>
<div data-slot="session-turn-summary-title-row">
<h2 data-slot="session-turn-summary-title">{i18n.t("ui.sessionTurn.summary.response")}</h2>
<Show when={response()}>
<div data-slot="session-turn-response-copy-wrapper">
<Tooltip
@@ -719,6 +713,7 @@ export function SessionTurn(
>
<IconButton
icon={copied() ? "check" : "copy"}
size="small"
variant="secondary"
onMouseDown={(e) => e.preventDefault()}
onClick={(event) => {
@@ -731,6 +726,14 @@ export function SessionTurn(
</div>
</Show>
</div>
<div data-slot="session-turn-response">
<Markdown
data-slot="session-turn-markdown"
data-diffs={hasDiffs()}
text={response() ?? ""}
cacheKey={responsePartId()}
/>
</div>
</div>
</div>
</Show>