Files
sweet/www/components/CodeBlock.tsx
T
Josh CollinsworthandMarvin Hagemeister e8d1a68b58 www: refresh home page (#2418)
Overhauls the Fresh homepage with a new design, new demos, and new
sections highlighting Fresh's capabilities.

---------

Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2024-05-17 16:08:55 +02:00

13 lines
425 B
TypeScript

import Prism from "$prism";
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}
><code dangerouslySetInnerHTML={{ __html: Prism.highlight(code, Prism.languages[lang], lang)}} /></pre>
);
}