feat(ui): tidy hotkeysmodal state

This commit is contained in:
psychedelicious 2024-01-04 23:00:15 +11:00 committed by Kent Keirsey
parent bbca053b48
commit ac04a834ef

View File

@ -41,11 +41,7 @@ type HotkeysModalProps = {
}; };
const HotkeysModal = ({ children }: HotkeysModalProps) => { const HotkeysModal = ({ children }: HotkeysModalProps) => {
const { const { isOpen, onOpen, onClose } = useDisclosure();
isOpen: isHotkeyModalOpen,
onOpen: onHotkeysModalOpen,
onClose: onHotkeysModalClose,
} = useDisclosure();
const { t } = useTranslation(); const { t } = useTranslation();
const [hotkeyFilter, setHotkeyFilter] = useState(''); const [hotkeyFilter, setHotkeyFilter] = useState('');
const clearHotkeyFilter = useCallback(() => setHotkeyFilter(''), []); const clearHotkeyFilter = useCallback(() => setHotkeyFilter(''), []);
@ -88,14 +84,9 @@ const HotkeysModal = ({ children }: HotkeysModalProps) => {
return ( return (
<> <>
{cloneElement(children, { {cloneElement(children, {
onClick: onHotkeysModalOpen, onClick: onOpen,
})} })}
<InvModal <InvModal isOpen={isOpen} onClose={onClose} isCentered size="2xl">
isOpen={isHotkeyModalOpen}
onClose={onHotkeysModalClose}
isCentered
size="2xl"
>
<InvModalOverlay /> <InvModalOverlay />
<InvModalContent maxH="80vh" h="80vh"> <InvModalContent maxH="80vh" h="80vh">
<InvModalHeader>{t('hotkeys.keyboardShortcuts')}</InvModalHeader> <InvModalHeader>{t('hotkeys.keyboardShortcuts')}</InvModalHeader>