2019-02-18 00:05:37 +00:00
|
|
|
import React from 'react';
|
|
|
|
import ReactDOM from 'react-dom';
|
2019-03-28 02:59:43 +00:00
|
|
|
import SharedFileView from './components/shared-file-view/shared-file-view';
|
|
|
|
import SharedFileViewTip from './components/shared-file-view/shared-file-view-tip';
|
2019-02-18 00:05:37 +00:00
|
|
|
|
|
|
|
import './css/image-file-view.css';
|
|
|
|
|
2019-03-28 02:59:43 +00:00
|
|
|
const { fileName, rawPath, err } = window.shared.pageOptions;
|
2019-02-18 00:05:37 +00:00
|
|
|
|
|
|
|
class SharedFileViewImage extends React.Component {
|
2019-03-28 02:59:43 +00:00
|
|
|
render() {
|
|
|
|
return <SharedFileView content={<FileContent />} />;
|
2019-02-18 00:05:37 +00:00
|
|
|
}
|
2019-03-28 02:59:43 +00:00
|
|
|
}
|
2019-02-18 00:05:37 +00:00
|
|
|
|
2019-03-28 02:59:43 +00:00
|
|
|
class FileContent extends React.Component {
|
|
|
|
render() {
|
2019-02-18 00:05:37 +00:00
|
|
|
if (err) {
|
2019-03-28 02:59:43 +00:00
|
|
|
return <SharedFileViewTip />;
|
2019-02-18 00:05:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2019-03-28 02:59:43 +00:00
|
|
|
<div className="shared-file-view-body d-flex text-center">
|
|
|
|
<div className="image-file-view flex-1">
|
|
|
|
<img src={rawPath} alt={fileName} id="image-view" />
|
2019-02-18 00:05:37 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ReactDOM.render(
|
|
|
|
<SharedFileViewImage />,
|
|
|
|
document.getElementById('wrapper')
|
|
|
|
);
|