feat: add deployment endpoint

This commit is contained in:
BennyKok
2023-12-14 22:36:57 +08:00
parent 0835d966f1
commit 7e05fae7b3
29 changed files with 1776 additions and 190 deletions
+30
View File
@@ -0,0 +1,30 @@
import { CopyButton } from "@/components/CopyButton";
import type { Lang } from "shiki";
import shiki from "shiki";
export async function CodeBlock(props: { code: string; lang: Lang }) {
const highlighter = await shiki.getHighlighter({
theme: "one-dark-pro",
});
return (
<div className="relative w-full max-w-full text-sm">
{/* max-w-[calc(32rem-1.5rem-1.5rem)] */}
{/* <div className=""> */}
<p
// tabIndex={1}
className="[&>pre]:p-4 rounded-sm "
style={{
overflowWrap: "break-word",
}}
dangerouslySetInnerHTML={{
__html: highlighter.codeToHtml(props.code.trim(), {
lang: props.lang,
}),
}}
/>
{/* </div> */}
<CopyButton className="absolute right-2 top-2" text={props.code} />
</div>
);
}