Files
sweet/www/components/CodeBlock.tsx
T
Marvin Hagemeister 3ad3e6ecf3 feat: support lazily loading routes/handlers (#3131)
We can improve cold start times by only loading route modules when the particular pattern matches. This PR introduces the concept of lazy middlewares, routes and handlers to do that.
2025-07-25 14:33:28 +02:00

14 lines
482 B
TypeScript

import { Prism } from "../utils/prism.ts";
export function CodeBlock(
{ code, lang }: { code: string; lang: "js" | "ts" | "jsx" | "md" | "bash" },
) {
return (
<pre
class="rounded-lg text-base leading-relaxed bg-slate-800 text-white p-4 sm:p-6 md:p-4 lg:p-6 2xl:p-8 overflow-x-auto"
data-language={lang}
// deno-lint-ignore react-no-danger
><code dangerouslySetInnerHTML={{ __html: Prism.highlight(code, Prism.languages[lang], lang)}} /></pre>
);
}