mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 14:37:21 +01:00
26 lines
624 B
TypeScript
26 lines
624 B
TypeScript
import React from 'react'
|
|
import { IPdfProps } from '../interfaces/IPdfProps'
|
|
|
|
export default function Preview({ pdfIsLoading, pdfError, pdfUrl }: IPdfProps) {
|
|
if (pdfIsLoading) {
|
|
return <div>Lade…</div>
|
|
}
|
|
|
|
if (pdfError) {
|
|
return (
|
|
<div className="flex items-center bg-red-100 border-solid border border-red-700 rounded text-red-700 py-2 px-3">
|
|
<span role="img" aria-label="Crying Man">
|
|
😢
|
|
</span>{' '}
|
|
{pdfError}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
if (!pdfUrl) {
|
|
return null
|
|
}
|
|
|
|
return <embed src={pdfUrl} className="h-screen w-auto" type="application/pdf" />
|
|
}
|