Refactor TemplatePreview for Improved Layout and Responsiveness

- Replaced a div with a Flex component to enhance layout and alignment of the TemplatePreview.
- Adjusted styles to ensure minimum width and proper cursor behavior during panning.
- Streamlined iframe rendering within the new structure for better responsiveness and user experience.
This commit is contained in:
Tom Butcher 2026-08-22 13:11:49 +01:00
parent 47e4e60b86
commit fb52a14dd0

View File

@ -614,29 +614,43 @@ const TemplatePreview = ({
touchAction: panMode ? 'none' : undefined
}}
>
<div
<Flex
justify='center'
align='center'
style={{
minWidth: '100%',
width: iframeSize.width,
height: iframeSize.height,
cursor: panMode ? (isPanning ? 'grabbing' : 'grab') : undefined
height: iframeSize.height
}}
>
<iframe
ref={iframeRef}
srcDoc={previewContentHTML}
onLoad={handleIframeLoad}
scrolling='no'
frameBorder='0'
<div
style={{
width: '100%',
height: iframeSize.height === 'auto' ? 150 : '100%',
display: 'block',
border: 0,
overflow: 'hidden',
pointerEvents: panMode ? 'none' : undefined
width: iframeSize.width,
height: iframeSize.height,
cursor: panMode
? isPanning
? 'grabbing'
: 'grab'
: undefined
}}
/>
</div>
>
<iframe
ref={iframeRef}
srcDoc={previewContentHTML}
onLoad={handleIframeLoad}
scrolling='no'
frameBorder='0'
style={{
width: '100%',
height: iframeSize.height === 'auto' ? 150 : '100%',
display: 'block',
border: 0,
overflow: 'hidden',
pointerEvents: panMode ? 'none' : undefined
}}
/>
</div>
</Flex>
</ScrollBox>
) : (
<PDFViewer