Skip to content

Commit

Permalink
making loading overlay absolute
Browse files Browse the repository at this point in the history
  • Loading branch information
vieirak79 committed Dec 9, 2024
1 parent 6ef7baf commit 6c56ef0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/helpers/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1336,15 +1336,17 @@ export function loadModernFormsCSS() {
document.head.appendChild(styleElm);
}
}
export function showLoadingOverlay(elm: HTMLElement, options?: {

interface ILoadingOverlayOptions {
bgColor?: string;
innerHtml?: string;
}) {
let overlay = elm.querySelector('.kw-loading-overlay') as HTMLDivElement;
innerHtml?: string;
}
export function showLoadingOverlay(elm: HTMLElement, options?: ILoadingOverlayOptions) {
let overlay = elm.querySelector('.kw-loading-overlay') as HTMLDivElement;
if (!overlay) {
overlay = document.createElement("div");
overlay.className = "kw-loading-overlay";
overlay.style.position = "fixed";
overlay.style.position = "absolute";
overlay.style.top = "0";
overlay.style.left = "0";
overlay.style.right = "0";
Expand All @@ -1354,6 +1356,7 @@ export function showLoadingOverlay(elm: HTMLElement, options?: {
overlay.style.justifyContent = "center";
overlay.style.alignItems = "center";
overlay.style.height = "100%";
overlay.style.width = "100%";
elm.appendChild(overlay);
}
overlay.innerHTML = options && options.innerHtml || `<img src="${LOGO_ANIM}" style="max-width: 30%;max-height: 30%;">`;
Expand All @@ -1365,10 +1368,7 @@ export function hideLoadingOverlay(elm: HTMLElement) {
removeHTMLElement(overlays);
}
}
export function getLoadingOverlayHtml(options?: {
bgColor?: string;
innerHtml?: string;
}) {
export function getLoadingOverlayHtml(options?: ILoadingOverlayOptions) {
let overlay = document.createElement("div");
showLoadingOverlay(overlay, options);
return overlay.innerHTML;
Expand Down
1 change: 1 addition & 0 deletions src/helpers/exports-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export * from './color';
export * from './cookies';
export * from './date';
export * from './debug';
export * from './diagrams';
export * from './emails';
export * from './eval';
export * from './file';
Expand Down

0 comments on commit 6c56ef0

Please sign in to comment.