Download app/components/PDFDownloadButton.tsx from lalabsai/drop-edit: direct link, hf CLI and curl.
- Browser
- Download file 998 Bytes
-
https://huggingface.co/spaces/lalabsai/drop-edit/resolve/main/app/components/PDFDownloadButton.tsx
- Command line
-
hf download hf://spaces/lalabsai/drop-edit/app/components/PDFDownloadButton.tsx
-
curl -L -o PDFDownloadButton.tsx https://huggingface.co/spaces/lalabsai/drop-edit/resolve/main/app/components/PDFDownloadButton.tsx
998 Bytes
| 'use client' | |
| import { PDFDownloadLink } from '@react-pdf/renderer' | |
| import ResultadoPDF from '@/app/components/ResultadoPDF' | |
| interface PDFDownloadButtonProps { | |
| resultado: any | |
| onDownload?: () => void | |
| } | |
| export default function PDFDownloadButton({ resultado, onDownload }: PDFDownloadButtonProps) { | |
| const slug = (resultado?.nome_estetica || 'editorial') | |
| .toString() | |
| .toLowerCase() | |
| .normalize('NFD') | |
| .replace(/[̀-ͯ]/g, '') | |
| .replace(/[^a-z0-9]+/g, '-') | |
| .replace(/^-|-$/g, '') | |
| return ( | |
| <PDFDownloadLink | |
| document={<ResultadoPDF resultado={resultado} />} | |
| fileName={`drop-edit-${slug}.pdf`} | |
| className="w-full text-center bg-gray-100 text-black border border-gray-200 text-[11px] font-medium tracking-widest uppercase py-4 hover:bg-black hover:text-white hover:border-black transition-colors block" | |
| onClick={() => onDownload?.()} | |
| > | |
| {({ loading }) => (loading ? 'Generating PDF…' : '↓ Download PDF')} | |
| </PDFDownloadLink> | |
| ) | |
| } | |