mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-30 18:30:32 -06:00
25 lines
564 B
TypeScript
25 lines
564 B
TypeScript
// components/ui/CodeBlock.tsx
|
|
import Prism from "prismjs";
|
|
import "prismjs/themes/prism.css";
|
|
import React, { useEffect } from "react";
|
|
|
|
interface CodeBlockProps {
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
const CodeBlock: React.FC<CodeBlockProps> = ({ children }) => {
|
|
useEffect(() => {
|
|
Prism.highlightAll();
|
|
}, [children]);
|
|
|
|
return (
|
|
<div className="group relative mt-4 rounded-md text-sm font-light text-slate-200 sm:text-base">
|
|
<pre>
|
|
<code className="language-js">{children}</code>
|
|
</pre>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default CodeBlock;
|