Extract Backbone Lightbox view module
This commit is contained in:
parent
8cfe12644a
commit
593976fe21
4 changed files with 38 additions and 7 deletions
|
@ -117,10 +117,6 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const lightboxContainer = document.querySelector('.lightboxContainer');
|
|
||||||
lightboxContainer.innerHTML = '';
|
|
||||||
lightboxContainer.style.display = 'block';
|
|
||||||
|
|
||||||
const props = {
|
const props = {
|
||||||
imageURL: this.objectUrl,
|
imageURL: this.objectUrl,
|
||||||
};
|
};
|
||||||
|
@ -128,10 +124,10 @@
|
||||||
Component: Signal.Components.Lightbox,
|
Component: Signal.Components.Lightbox,
|
||||||
props,
|
props,
|
||||||
onClose: () => {
|
onClose: () => {
|
||||||
lightboxContainer.style.display = 'none';
|
Signal.Backbone.Views.Lightbox.hide();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
lightboxContainer.appendChild(this.lightboxView.el);
|
Signal.Backbone.Views.Lightbox.show(this.lightboxView.el);
|
||||||
},
|
},
|
||||||
isVoiceMessage() {
|
isVoiceMessage() {
|
||||||
// eslint-disable-next-line no-bitwise
|
// eslint-disable-next-line no-bitwise
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
/**
|
||||||
|
* @prettier
|
||||||
|
*/
|
||||||
import * as Conversation from './Conversation';
|
import * as Conversation from './Conversation';
|
||||||
|
import * as Views from './views';
|
||||||
|
|
||||||
export { Conversation };
|
export { Conversation, Views };
|
||||||
|
|
25
ts/backbone/views/Lightbox.ts
Normal file
25
ts/backbone/views/Lightbox.ts
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
/**
|
||||||
|
* @prettier
|
||||||
|
*/
|
||||||
|
export const show = (element: HTMLElement): void => {
|
||||||
|
const container: HTMLDivElement | null = document.querySelector(
|
||||||
|
'.lightboxContainer'
|
||||||
|
);
|
||||||
|
if (container === null) {
|
||||||
|
throw new TypeError("'.lightboxContainer' is required");
|
||||||
|
}
|
||||||
|
container.innerHTML = '';
|
||||||
|
container.style.display = 'block';
|
||||||
|
container.appendChild(element);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const hide = (): void => {
|
||||||
|
const container: HTMLDivElement | null = document.querySelector(
|
||||||
|
'.lightboxContainer'
|
||||||
|
);
|
||||||
|
if (container === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
container.innerHTML = '';
|
||||||
|
container.style.display = 'none';
|
||||||
|
};
|
6
ts/backbone/views/index.ts
Normal file
6
ts/backbone/views/index.ts
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
/**
|
||||||
|
* @prettier
|
||||||
|
*/
|
||||||
|
import * as Lightbox from './Lightbox';
|
||||||
|
|
||||||
|
export { Lightbox };
|
Loading…
Add table
Reference in a new issue