Skip to content

Commit a216c4a

Browse files
committed
fix: copy button position
1 parent 1aabb6b commit a216c4a

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

components/CodeBlock.tsx

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,26 @@ export function CodeBlock({ className, children, ...props }: ICodeBlock) {
2929
}
3030
};
3131
return (
32-
<pre
33-
className={cn(
34-
"relative overflow-x-auto rounded bg-[#282A36] mt-3 mb-6 p-4",
35-
className
36-
)}
37-
{...props}
38-
>
39-
<Button
40-
id="cody-copy-button"
41-
data-umami-event="copy-code-button"
42-
disabled={hasCopied}
43-
className="absolute top-4 right-4 z-10"
44-
size="sm"
45-
onClick={handleClickCopy}
32+
<div className="relative">
33+
<pre
34+
className={cn(
35+
"overflow-x-auto rounded bg-[#282A36] mt-3 mb-6 p-4",
36+
className
37+
)}
38+
{...props}
4639
>
47-
{hasCopied ? "Copied" : "Copy"}
48-
</Button>
49-
<span ref={preRef}>{children}</span>
50-
</pre>
40+
<Button
41+
id="cody-copy-button"
42+
data-umami-event="copy-code-button"
43+
disabled={hasCopied}
44+
className="absolute top-4 right-4 z-10"
45+
size="sm"
46+
onClick={handleClickCopy}
47+
>
48+
{hasCopied ? "Copied" : "Copy"}
49+
</Button>
50+
<span ref={preRef}>{children}</span>
51+
</pre>
52+
</div>
5153
);
5254
}

0 commit comments

Comments
 (0)