Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(cherry picked from commit 6d552f2a60f44052079b5e8944f5e1bbabac56e0)
- Loading branch information
1 parent
30fd7c8
commit 218371a
Showing
15 changed files
with
381 additions
and
460 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useCallback, useState } from 'react'; | ||
|
||
export default function useModalOpenState( | ||
initialState: boolean | ||
): [boolean, () => void, () => void] { | ||
const [isOpen, setOpen] = useState(initialState); | ||
|
||
const setModalOpen = useCallback(() => { | ||
setOpen(true); | ||
}, [setOpen]); | ||
|
||
const setModalClosed = useCallback(() => { | ||
setOpen(false); | ||
}, [setOpen]); | ||
|
||
return [isOpen, setModalOpen, setModalClosed]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.