mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 14:37:21 +01:00
add pdf-js viewer
This commit is contained in:
7
webapp/views/components/Button.js
Normal file
7
webapp/views/components/Button.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import { h } from 'preact';
|
||||
|
||||
export default function(props) {
|
||||
return (
|
||||
<button onClick={props.onClick}>{props.text}</button>
|
||||
);
|
||||
}
|
||||
10
webapp/views/components/Input.js
Normal file
10
webapp/views/components/Input.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import { h } from 'preact';
|
||||
|
||||
export default function(props) {
|
||||
return (
|
||||
<label>
|
||||
{props.text}:
|
||||
<input onChange={props.onChange.bind(null, props.name)} type="text" />
|
||||
</label>
|
||||
);
|
||||
}
|
||||
24
webapp/views/components/Preview.js
Normal file
24
webapp/views/components/Preview.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Component, h } from 'preact';
|
||||
import PDF from 'react-pdf';
|
||||
|
||||
class Preview extends Component {
|
||||
render(props) {
|
||||
return (
|
||||
<PDF
|
||||
content={props.pdf}
|
||||
onDocumentComplete={this._onDocumentComplete}
|
||||
onPageComplete={this._onPageComplete}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
_onDocumentComplete(pages) {
|
||||
this.setState({pages: pages});
|
||||
}
|
||||
|
||||
_onPageComplete(page) {
|
||||
this.setState({page});
|
||||
}
|
||||
}
|
||||
|
||||
export default Preview;
|
||||
Reference in New Issue
Block a user