generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #143 from bcgov/TICDI-324_Preview
Preview the template doc
- Loading branch information
Showing
8 changed files
with
1,470 additions
and
63 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
frontend/src/app/components/modal/admin/manage-templates/PreviewTemplateModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import React from 'react'; | ||
import Button from 'react-bootstrap/Button'; | ||
|
||
interface PreviewTemplateModalProps { | ||
isOpen: boolean; | ||
toggleModal: () => void; | ||
iframeSrcBlob: Blob | null; | ||
} | ||
|
||
const PreviewTemplateModal: React.FC<PreviewTemplateModalProps> = ({ isOpen, toggleModal, iframeSrcBlob }) => { | ||
const iframeSrc = iframeSrcBlob ? window.URL.createObjectURL(iframeSrcBlob) : ''; | ||
|
||
const modalOverlayStyle: React.CSSProperties = { | ||
position: 'fixed', | ||
top: 0, | ||
left: 0, | ||
width: '100%', | ||
height: '100%', | ||
backgroundColor: 'rgba(0, 0, 0, 0.5)', | ||
zIndex: 9999, | ||
display: isOpen ? 'flex' : 'none', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}; | ||
|
||
const modalContentStyle: React.CSSProperties = { | ||
width: '80%', | ||
height: '80%', | ||
backgroundColor: '#fff', | ||
borderRadius: '8px', | ||
overflow: 'hidden', | ||
position: 'relative', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
}; | ||
|
||
const iframeContainerStyle: React.CSSProperties = { | ||
flex: 1, | ||
overflow: 'auto', | ||
padding: '20px', | ||
}; | ||
|
||
const buttonContainerStyle: React.CSSProperties = { | ||
textAlign: 'right', // Align button to the right | ||
padding: '20px', | ||
}; | ||
|
||
return ( | ||
<div style={modalOverlayStyle} onClick={toggleModal}> | ||
<div style={modalContentStyle} onClick={(e) => e.stopPropagation()}> | ||
<div style={iframeContainerStyle}> | ||
<h2>Preview Document</h2> | ||
{iframeSrc && ( | ||
<iframe | ||
src={iframeSrc} | ||
title="Example Iframe" | ||
style={{ border: 'none', width: '100%', height: '100%' }} | ||
allowFullScreen | ||
/> | ||
)} | ||
</div> | ||
<div style={buttonContainerStyle}> | ||
<Button variant="secondary" onClick={toggleModal}> | ||
Close | ||
</Button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PreviewTemplateModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters