fix(app): copy buttons smaller and out of the way
This commit is contained in:
@@ -120,6 +120,11 @@
|
|||||||
gap: calc(var(--spacing) * 0.5);
|
gap: calc(var(--spacing) * 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&[data-size="small"] {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
&[data-size="large"] {
|
&[data-size="large"] {
|
||||||
height: 32px;
|
height: 32px;
|
||||||
/* padding: 0 8px 0 6px; */
|
/* padding: 0 8px 0 6px; */
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { Icon, IconProps } from "./icon"
|
|||||||
|
|
||||||
export interface IconButtonProps extends ComponentProps<typeof Kobalte> {
|
export interface IconButtonProps extends ComponentProps<typeof Kobalte> {
|
||||||
icon: IconProps["name"]
|
icon: IconProps["name"]
|
||||||
size?: "normal" | "large"
|
size?: "small" | "normal" | "large"
|
||||||
iconSize?: IconProps["size"]
|
iconSize?: IconProps["size"]
|
||||||
variant?: "primary" | "secondary" | "ghost"
|
variant?: "primary" | "secondary" | "ghost"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ function createCopyButton(labels: CopyLabels) {
|
|||||||
button.type = "button"
|
button.type = "button"
|
||||||
button.setAttribute("data-component", "icon-button")
|
button.setAttribute("data-component", "icon-button")
|
||||||
button.setAttribute("data-variant", "secondary")
|
button.setAttribute("data-variant", "secondary")
|
||||||
button.setAttribute("data-size", "normal")
|
button.setAttribute("data-size", "small")
|
||||||
button.setAttribute("data-slot", "markdown-copy-button")
|
button.setAttribute("data-slot", "markdown-copy-button")
|
||||||
button.setAttribute("aria-label", labels.copy)
|
button.setAttribute("aria-label", labels.copy)
|
||||||
button.setAttribute("title", labels.copy)
|
button.setAttribute("title", labels.copy)
|
||||||
|
|||||||
@@ -121,7 +121,7 @@
|
|||||||
|
|
||||||
[data-slot="text-part-copy-wrapper"] {
|
[data-slot="text-part-copy-wrapper"] {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 8px;
|
top: -28px;
|
||||||
right: 8px;
|
right: 8px;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity 0.15s ease;
|
transition: opacity 0.15s ease;
|
||||||
|
|||||||
@@ -425,6 +425,7 @@ export function UserMessageDisplay(props: { message: UserMessage; parts: PartTyp
|
|||||||
>
|
>
|
||||||
<IconButton
|
<IconButton
|
||||||
icon={copied() ? "check" : "copy"}
|
icon={copied() ? "check" : "copy"}
|
||||||
|
size="small"
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
onMouseDown={(e) => e.preventDefault()}
|
onMouseDown={(e) => e.preventDefault()}
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
@@ -694,6 +695,7 @@ PART_MAPPING["text"] = function TextPartDisplay(props) {
|
|||||||
>
|
>
|
||||||
<IconButton
|
<IconButton
|
||||||
icon={copied() ? "check" : "copy"}
|
icon={copied() ? "check" : "copy"}
|
||||||
|
size="small"
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
onMouseDown={(e) => e.preventDefault()}
|
onMouseDown={(e) => e.preventDefault()}
|
||||||
onClick={handleCopy}
|
onClick={handleCopy}
|
||||||
|
|||||||
@@ -219,22 +219,28 @@
|
|||||||
gap: 4px;
|
gap: 4px;
|
||||||
align-self: stretch;
|
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"] {
|
[data-slot="session-turn-response"] {
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-slot="session-turn-response-copy-wrapper"] {
|
[data-slot="session-turn-response-copy-wrapper"] {
|
||||||
position: absolute;
|
|
||||||
top: 8px;
|
|
||||||
right: 8px;
|
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
transition: opacity 0.15s ease;
|
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;
|
opacity: 1;
|
||||||
|
pointer-events: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
|
|||||||
@@ -702,14 +702,8 @@ export function SessionTurn(
|
|||||||
<Show when={!working() && response()}>
|
<Show when={!working() && response()}>
|
||||||
<div data-slot="session-turn-summary-section">
|
<div data-slot="session-turn-summary-section">
|
||||||
<div data-slot="session-turn-summary-header">
|
<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-summary-title-row">
|
||||||
<div data-slot="session-turn-response">
|
<h2 data-slot="session-turn-summary-title">{i18n.t("ui.sessionTurn.summary.response")}</h2>
|
||||||
<Markdown
|
|
||||||
data-slot="session-turn-markdown"
|
|
||||||
data-diffs={hasDiffs()}
|
|
||||||
text={response() ?? ""}
|
|
||||||
cacheKey={responsePartId()}
|
|
||||||
/>
|
|
||||||
<Show when={response()}>
|
<Show when={response()}>
|
||||||
<div data-slot="session-turn-response-copy-wrapper">
|
<div data-slot="session-turn-response-copy-wrapper">
|
||||||
<Tooltip
|
<Tooltip
|
||||||
@@ -719,6 +713,7 @@ export function SessionTurn(
|
|||||||
>
|
>
|
||||||
<IconButton
|
<IconButton
|
||||||
icon={copied() ? "check" : "copy"}
|
icon={copied() ? "check" : "copy"}
|
||||||
|
size="small"
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
onMouseDown={(e) => e.preventDefault()}
|
onMouseDown={(e) => e.preventDefault()}
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
@@ -731,6 +726,14 @@ export function SessionTurn(
|
|||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
|
<div data-slot="session-turn-response">
|
||||||
|
<Markdown
|
||||||
|
data-slot="session-turn-markdown"
|
||||||
|
data-diffs={hasDiffs()}
|
||||||
|
text={response() ?? ""}
|
||||||
|
cacheKey={responsePartId()}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
|
|||||||
Reference in New Issue
Block a user