add alf dialogs to useCloseAllActiveElements (#3021)
parent
60eb6e23d1
commit
a697b39c48
|
@ -3,6 +3,7 @@ import {useLightboxControls} from './lightbox'
|
||||||
import {useModalControls} from './modals'
|
import {useModalControls} from './modals'
|
||||||
import {useComposerControls} from './shell/composer'
|
import {useComposerControls} from './shell/composer'
|
||||||
import {useSetDrawerOpen} from './shell/drawer-open'
|
import {useSetDrawerOpen} from './shell/drawer-open'
|
||||||
|
import {useDialogStateControlContext} from 'state/dialogs'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns true if something was closed
|
* returns true if something was closed
|
||||||
|
@ -35,11 +36,19 @@ export function useCloseAllActiveElements() {
|
||||||
const {closeLightbox} = useLightboxControls()
|
const {closeLightbox} = useLightboxControls()
|
||||||
const {closeAllModals} = useModalControls()
|
const {closeAllModals} = useModalControls()
|
||||||
const {closeComposer} = useComposerControls()
|
const {closeComposer} = useComposerControls()
|
||||||
|
const {closeAllDialogs: closeAlfDialogs} = useDialogStateControlContext()
|
||||||
const setDrawerOpen = useSetDrawerOpen()
|
const setDrawerOpen = useSetDrawerOpen()
|
||||||
return useCallback(() => {
|
return useCallback(() => {
|
||||||
closeLightbox()
|
closeLightbox()
|
||||||
closeAllModals()
|
closeAllModals()
|
||||||
closeComposer()
|
closeComposer()
|
||||||
|
closeAlfDialogs()
|
||||||
setDrawerOpen(false)
|
setDrawerOpen(false)
|
||||||
}, [closeLightbox, closeAllModals, closeComposer, setDrawerOpen])
|
}, [
|
||||||
|
closeLightbox,
|
||||||
|
closeAllModals,
|
||||||
|
closeComposer,
|
||||||
|
closeAlfDialogs,
|
||||||
|
setDrawerOpen,
|
||||||
|
])
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue