Close active elements on state change (#677)
This commit is contained in:
parent
09bb2f5208
commit
656baa7239
2 changed files with 14 additions and 3 deletions
|
@ -21,6 +21,9 @@ interface Img {
|
|||
|
||||
export const Lightbox = observer(function Lightbox() {
|
||||
const store = useStores()
|
||||
|
||||
const onClose = useCallback(() => store.shell.closeLightbox(), [store.shell])
|
||||
|
||||
if (!store.shell.isLightboxActive) {
|
||||
return null
|
||||
}
|
||||
|
@ -29,8 +32,6 @@ export const Lightbox = observer(function Lightbox() {
|
|||
const initialIndex =
|
||||
activeLightbox instanceof models.ImagesLightbox ? activeLightbox.index : 0
|
||||
|
||||
const onClose = () => store.shell.closeLightbox()
|
||||
|
||||
let imgs: Img[] | undefined
|
||||
if (activeLightbox instanceof models.ProfileImageLightbox) {
|
||||
const opts = activeLightbox
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue