mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 06:27:19 +01:00
start over with nextjs
This commit is contained in:
37
components/Preview.tsx
Normal file
37
components/Preview.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import React from 'react';
|
||||
|
||||
export default props => {
|
||||
if (props.pdfIsLoading) {
|
||||
return (
|
||||
<div>Lade…</div>
|
||||
);
|
||||
}
|
||||
|
||||
const errorStyles = {
|
||||
padding: '6px 12px',
|
||||
color: 'white',
|
||||
backgroundColor: '#d81e1e',
|
||||
borderRadius: '3px',
|
||||
};
|
||||
|
||||
if (props.pdfError) {
|
||||
return (
|
||||
<div style={errorStyles}><span role="img" aria-label="Crying Man">😢</span> {props.pdfError}</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!props.pdfUrl) {
|
||||
return (
|
||||
<div>Knopf drücken dann gibts hier was zu sehen!</div>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = {
|
||||
width: '700px',
|
||||
height: '1050px'
|
||||
};
|
||||
|
||||
return (
|
||||
<embed src={props.pdfUrl} style={styles} type="application/pdf" />
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user