14 lines
394 B
TypeScript
14 lines
394 B
TypeScript
|
|
export const CodeBlock = ({ code }: { code: string }) => (
|
||
|
|
<div className="position-relative">
|
||
|
|
<pre className="bg-dark text-white p-3 rounded overflow-auto mb-0">
|
||
|
|
<code>{code}</code>
|
||
|
|
</pre>
|
||
|
|
<button
|
||
|
|
className="btn btn-sm btn-light position-absolute top-0 end-0 m-2"
|
||
|
|
onClick={() => navigator.clipboard.writeText(code)}
|
||
|
|
>
|
||
|
|
Copiar
|
||
|
|
</button>
|
||
|
|
</div>
|
||
|
|
);
|