32 lines
559 B
TypeScript
32 lines
559 B
TypeScript
|
|
// components/CopyButton.tsx
|
||
|
|
"use client"
|
||
|
|
|
||
|
|
interface CopyButtonProps {
|
||
|
|
text: string
|
||
|
|
}
|
||
|
|
|
||
|
|
export function CopyButton({ text }: CopyButtonProps) {
|
||
|
|
const handleCopy = () => {
|
||
|
|
navigator.clipboard.writeText(text)
|
||
|
|
alert("Código copiado!")
|
||
|
|
}
|
||
|
|
|
||
|
|
return (
|
||
|
|
<button
|
||
|
|
onClick={handleCopy}
|
||
|
|
style={{
|
||
|
|
padding: "1rem 2rem",
|
||
|
|
background: "#667eea",
|
||
|
|
color: "white",
|
||
|
|
border: "none",
|
||
|
|
borderRadius: "0.375rem",
|
||
|
|
cursor: "pointer",
|
||
|
|
fontWeight: "500"
|
||
|
|
}}
|
||
|
|
>
|
||
|
|
Copiar
|
||
|
|
</button>
|
||
|
|
)
|
||
|
|
}
|
||
|
|
|