signal-desktop/ts/backbone/views/Lightbox.ts

26 lines
664 B
TypeScript
Raw Normal View History

2020-10-30 20:34:04 +00:00
// Copyright 2018-2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
2018-04-15 04:33:35 +00:00
export const show = (element: HTMLElement): void => {
const container: HTMLDivElement | null = document.querySelector(
2018-04-24 16:06:43 +00:00
'.lightbox-container'
2018-04-15 04:33:35 +00:00
);
2019-01-14 21:49:58 +00:00
if (!container) {
2018-04-24 16:06:43 +00:00
throw new TypeError("'.lightbox-container' is required");
2018-04-15 04:33:35 +00:00
}
container.innerHTML = '';
container.style.display = 'block';
container.appendChild(element);
};
export const hide = (): void => {
const container: HTMLDivElement | null = document.querySelector(
2018-04-24 16:06:43 +00:00
'.lightbox-container'
2018-04-15 04:33:35 +00:00
);
2019-01-14 21:49:58 +00:00
if (!container) {
2018-04-15 04:33:35 +00:00
return;
}
container.innerHTML = '';
container.style.display = 'none';
};