Spaces:
Runtime error
Runtime error
Fix "Copy" button styling. Relates to issue 1387 (#1403)
Browse files* Fix styling of "Copy to Clipboard" button
* Updated so that Code Block copy button behaves as before.
* fix linting issue.
---------
Co-authored-by: Nathan Sarrazin <sarrazin.nathan@gmail.com>
src/lib/components/CodeBlock.svelte
CHANGED
|
@@ -24,7 +24,7 @@
|
|
| 24 |
>{@html DOMPurify.sanitize(highlightedCode || code.replaceAll("<", "<"))}
|
| 25 |
</code></pre>
|
| 26 |
<CopyToClipBoardBtn
|
| 27 |
-
classNames="absolute top-2 right-2 invisible opacity-0 group-hover:visible group-hover:opacity-100"
|
| 28 |
value={code}
|
| 29 |
/>
|
| 30 |
</div>
|
|
|
|
| 24 |
>{@html DOMPurify.sanitize(highlightedCode || code.replaceAll("<", "<"))}
|
| 25 |
</code></pre>
|
| 26 |
<CopyToClipBoardBtn
|
| 27 |
+
classNames="btn rounded-lg border border-gray-200 px-2 py-2 text-sm shadow-sm transition-all hover:border-gray-300 active:shadow-inner dark:border-gray-700 dark:hover:border-gray-500 absolute top-2 right-2 invisible opacity-0 group-hover:visible group-hover:opacity-100 dark:text-gray-700 text-gray-200"
|
| 28 |
value={code}
|
| 29 |
/>
|
| 30 |
</div>
|
src/lib/components/CopyToClipBoardBtn.svelte
CHANGED
|
@@ -35,7 +35,7 @@
|
|
| 35 |
</script>
|
| 36 |
|
| 37 |
<button
|
| 38 |
-
class=
|
| 39 |
title={"Copy to clipboard"}
|
| 40 |
type="button"
|
| 41 |
on:click
|
|
@@ -43,7 +43,7 @@
|
|
| 43 |
>
|
| 44 |
<div class="relative">
|
| 45 |
<slot>
|
| 46 |
-
<IconCopy classNames="
|
| 47 |
</slot>
|
| 48 |
|
| 49 |
<Tooltip classNames={isSuccess ? "opacity-100" : "opacity-0"} />
|
|
|
|
| 35 |
</script>
|
| 36 |
|
| 37 |
<button
|
| 38 |
+
class={classNames}
|
| 39 |
title={"Copy to clipboard"}
|
| 40 |
type="button"
|
| 41 |
on:click
|
|
|
|
| 43 |
>
|
| 44 |
<div class="relative">
|
| 45 |
<slot>
|
| 46 |
+
<IconCopy classNames="h-[1.14em] w-[1.14em]" />
|
| 47 |
</slot>
|
| 48 |
|
| 49 |
<Tooltip classNames={isSuccess ? "opacity-100" : "opacity-0"} />
|
src/lib/components/chat/ChatMessage.svelte
CHANGED
|
@@ -379,7 +379,7 @@
|
|
| 379 |
on:click={() => {
|
| 380 |
isCopied = true;
|
| 381 |
}}
|
| 382 |
-
classNames="
|
| 383 |
value={message.content}
|
| 384 |
/>
|
| 385 |
</div>
|
|
|
|
| 379 |
on:click={() => {
|
| 380 |
isCopied = true;
|
| 381 |
}}
|
| 382 |
+
classNames="btn rounded-sm p-1 text-sm text-gray-400 hover:text-gray-500 focus:ring-0 dark:text-gray-400 dark:hover:text-gray-300"
|
| 383 |
value={message.content}
|
| 384 |
/>
|
| 385 |
</div>
|