2019-05-09 00:47:39 +02:00
|
|
|
// @flow
|
|
|
|
import * as React from 'react';
|
2019-05-16 08:32:53 +02:00
|
|
|
import Villain from 'villain';
|
|
|
|
import 'villain/dist/style.css';
|
2019-05-09 00:47:39 +02:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
source: {
|
|
|
|
fileType: string,
|
2019-05-16 08:32:53 +02:00
|
|
|
downloadPath: string,
|
2019-05-09 00:47:39 +02:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2019-05-16 08:32:53 +02:00
|
|
|
const opts = {
|
|
|
|
workerPath: '/webworkers/worker-bundle.js',
|
2019-05-23 07:35:48 +02:00
|
|
|
allowFullScreen: false,
|
|
|
|
autoHideControls: true,
|
2019-05-16 08:32:53 +02:00
|
|
|
};
|
2019-05-09 00:47:39 +02:00
|
|
|
|
2019-05-16 08:32:53 +02:00
|
|
|
class ComicBookViewer extends React.PureComponent<Props> {
|
2019-05-09 00:47:39 +02:00
|
|
|
render() {
|
2019-05-16 08:32:53 +02:00
|
|
|
const { downloadPath } = this.props.source || {};
|
|
|
|
const file = `file://${downloadPath}`;
|
|
|
|
|
|
|
|
return <Villain file={file} width={'100%'} height={'100%'} options={opts} />;
|
2019-05-09 00:47:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ComicBookViewer;
|