mirror of
https://github.com/sergi0g/cup.git
synced 2025-11-08 13:13:49 -05:00
fix: code block component copying was working incorrectly (#62)
This commit is contained in:
@@ -21,6 +21,8 @@ export function CodeBlock({
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const copyText = children instanceof Array ? children.join("") : children;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`group relative flex w-full items-center rounded-lg bg-${theme}-100 px-3 py-2 font-mono text-${theme}-700 dark:bg-${theme}-950 dark:text-${theme}-300`}
|
className={`group relative flex w-full items-center rounded-lg bg-${theme}-100 px-3 py-2 font-mono text-${theme}-700 dark:bg-${theme}-950 dark:text-${theme}-300`}
|
||||||
@@ -35,7 +37,7 @@ export function CodeBlock({
|
|||||||
) : (
|
) : (
|
||||||
<button
|
<button
|
||||||
className={`duration-50 absolute right-3 bg-${theme}-100 py-1 pl-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-${theme}-950`}
|
className={`duration-50 absolute right-3 bg-${theme}-100 py-1 pl-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-${theme}-950`}
|
||||||
onClick={handleCopy(`docker pull ${children}`)}
|
onClick={handleCopy(`${copyText}`)}
|
||||||
>
|
>
|
||||||
<Clipboard className="size-5" />
|
<Clipboard className="size-5" />
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user