spb/autoscholar
Public
1export function PdfViewer({2 src,3 title,4 downloadHref,5}: {6 src: string;7 title: string;8 downloadHref?: string;9}) {10 return (11 <figure className="surface overflow-hidden">12 <object data={src} type="application/pdf" className="h-[70vh] w-full" aria-label={`PDF: ${title}`}>13 <div className="p-6 text-sm">14 <p className="muted">Your browser cannot display PDFs inline.</p>15 <a className="btn mt-3" href={downloadHref ?? src}>16 Download the PDF17 </a>18 </div>19 </object>20 <figcaption className="subtle flex items-center justify-between px-4 py-2 text-xs">21 <span>{title}</span>22 <a href={downloadHref ?? `${src}?download=1`}>Download PDF</a>23 </figcaption>24 </figure>25 );26}27