Initial scaffold: Researcher Endorsement frontend
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
23
src/components/PDFPreview.tsx
Normal file
23
src/components/PDFPreview.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import React, { useEffect } from 'react'
|
||||
|
||||
const PDFPreview: React.FC<{ url: string; name?: string }> = ({ url, name }) => {
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
// only revoke blob URLs
|
||||
try {
|
||||
if (url && url.startsWith('blob:')) URL.revokeObjectURL(url)
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}, [url])
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="small">{name}</div>
|
||||
<iframe src={url} width="100%" height={300} title={name ?? 'pdf'} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default PDFPreview
|
||||
Reference in New Issue
Block a user