diff --git a/app/components/DocumentPreview.tsx b/app/components/DocumentPreview.tsx new file mode 100644 index 0000000..310f07d --- /dev/null +++ b/app/components/DocumentPreview.tsx @@ -0,0 +1,37 @@ +import React from 'react'; +import { Button } from "@/components/ui/button" +import { Textarea } from './ui/textarea'; + + +type Props = { + content: string; +}; +const DocumentPreview: React.FC = ({ content }) => { + const handleCopyContent = () => { + navigator.clipboard.writeText(content); + }; + + const handleDownload = () => { + const blob = new Blob([content], { type: 'text/plain' }); + const url = URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = 'generated_document.txt'; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + URL.revokeObjectURL(url); + }; + + return ( +
+