This commit is contained in:
laura 2025-11-01 23:46:32 -03:00
parent 30f2b4714d
commit 0c9f7a7822
Signed by: w
GPG key ID: BCD2117C99E69817
21 changed files with 1868 additions and 1839 deletions

View file

@ -6,25 +6,24 @@
import { ComponentChildren } from "preact";
interface CodeProps {
children: ComponentChildren;
[key: string]: any;
children: ComponentChildren;
[key: string]: any;
}
export default function Code({ children, ...props }: CodeProps) {
const handleClick = () => {
if (typeof children === "string") {
navigator.clipboard.writeText(children);
}
};
return (
<code
class="inline-code"
onClick={handleClick}
style={{ cursor: "pointer" }}
title={"Click to copy"}
{...props}
>
<span>{children}</span>
</code>
);
const handleClick = () => {
if (typeof children === "string") {
navigator.clipboard.writeText(children);
}
};
return (
<button
class="inline-code"
onClick={handleClick}
title="Click to copy"
{...props}
>
<span>{children}</span>
</button>
);
}