Hide external action modal spinner

This commit is contained in:
Gabe Kangas
2021-03-31 22:28:55 -07:00
parent 1f659c47b0
commit 12f56f5571
2 changed files with 12 additions and 4 deletions

View File

@@ -1,8 +1,15 @@
import { h } from '/js/web_modules/preact.js'; import { h } from '/js/web_modules/preact.js';
import htm from '/js/web_modules/htm.js'; import htm from '/js/web_modules/htm.js';
const html = htm.bind(h); const html = htm.bind(h);
export default function ExternalActionModal({ url, title, onClose }) { export default function ExternalActionModal({ url, title, onClose }) {
const loading = 'background:url(/img/loading.gif) center center no-repeat;'
function loaded() {
document.querySelector("#external-modal-iframe").style = '';
}
return html` return html`
<div class="fixed inset-0 overflow-y-auto" style="z-index: 9999"> <div class="fixed inset-0 overflow-y-auto" style="z-index: 9999">
<div <div
@@ -47,14 +54,15 @@ export default function ExternalActionModal({ url, title, onClose }) {
</span> </span>
</div> </div>
<!-- TODO: Show a loading spinner while the iframe loads -->
<iframe <iframe
style="height: 70vh" id="external-modal-iframe"
style=${`${loading}`}
width="100%" width="100%"
allowpaymentrequest="true" allowpaymentrequest="true"
allowfullscreen="false" allowfullscreen="false"
sandbox="allow-same-origin allow-scripts allow-popups allow-forms" sandbox="allow-same-origin allow-scripts allow-popups allow-forms"
src=${url} src=${url}
onload=${loaded}
/> />
</div> </div>
</div> </div>

View File

@@ -285,6 +285,6 @@ header {
} }
} }
iframe{ #external-modal-iframe {
background:url(/img/loading.gif) center center no-repeat; height: 100%; height: 70vh;
} }