i forgot
This commit is contained in:
parent
30f2b4714d
commit
0c9f7a7822
21 changed files with 1868 additions and 1839 deletions
|
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue