Modifying height of iframes for Map/Zim viewers to show full page of iframe.

This commit is contained in:
Roland 2024-04-16 10:34:05 -06:00
parent ed1ed94beb
commit 62c4afce0b
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
4 changed files with 37 additions and 19 deletions

View file

@ -21,6 +21,7 @@ import {SemanticToastContainer} from "react-semantic-toasts-2";
import {FilePreviewProvider} from "./components/FilePreview";
import {TagsProvider} from "./Tags";
import {ZimRoute} from "./components/Zim";
import {IframeViewer} from "./components/Common";
function PageNotFound() {
const {t} = useContext(ThemeContext);

View file

@ -1676,3 +1676,35 @@ export const monthNames = [
'November',
'December',
];
export function IframeViewer({title, viewerUrl}) {
// Bottom of iframe is hidden when height is 100%. These values display the entire iframe.
return <>
<Media at='mobile'>
<iframe
title={title}
src={viewerUrl}
style={{
position: 'fixed',
height: '80%',
width: '100%',
border: 'none',
padding: 0,
backgroundColor: '#FFFFFF',
}}/>
</Media>
<Media greaterThan='mobile'>
<iframe
title={title}
src={viewerUrl}
style={{
position: 'fixed',
height: '93%',
width: '100%',
border: 'none',
padding: 0,
backgroundColor: '#FFFFFF',
}}/>
</Media>
</>
}

View file

@ -4,6 +4,7 @@ import {
ErrorMessage,
HelpPopup,
humanFileSize,
IframeViewer,
InfoMessage,
PageContainer,
TabLinks,
@ -281,15 +282,7 @@ class ManageMap extends React.Component {
}
function MapPage() {
return <iframe
title='map'
src={`http://${window.location.hostname}:8084/`}
style={{
position: 'fixed',
height: '100%',
width: '100%',
border: 'none',
}}/>
return <IframeViewer title='map' viewerUrl={`http://${window.location.hostname}:8084/`}/>
}
export function MapRoute() {

View file

@ -34,6 +34,7 @@ import {
encodeMediaPath,
ErrorMessage,
humanFileSize,
IframeViewer,
InfoMessage,
normalizeEstimate,
PageContainer,
@ -529,16 +530,7 @@ class ManageZim extends React.Component {
}
function ZimViewer() {
return <iframe
title='zim'
src={VIEWER_URL}
style={{
position: 'fixed',
height: '100%',
width: '100%',
border: 'none',
backgroundColor: '#FFFFFF',
}}/>
return <IframeViewer title='zim' viewerUrl={VIEWER_URL}/>
}
export function ZimRoute() {