From 267f546913b3be2978fc3f9af79af0b4bfe5c7a3 Mon Sep 17 00:00:00 2001 From: Mirved64 Date: Wed, 27 Sep 2023 10:12:14 +0400 Subject: [PATCH] chore: type some functions --- landing/fragments/landing-faq/src/faq.component.tsx | 8 ++++---- .../src/question-modal/question-modal.interfaces.ts | 4 +++- .../landing-navigation/src/drawer/drawer.interfaces.ts | 4 +++- ui/form/src/form.component.tsx | 6 +++--- ui/form/src/form.interfaces.ts | 8 ++++++-- ui/modal/src/modal.interfaces.tsx | 6 ++++-- 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/landing/fragments/landing-faq/src/faq.component.tsx b/landing/fragments/landing-faq/src/faq.component.tsx index b597b539..b405242a 100644 --- a/landing/fragments/landing-faq/src/faq.component.tsx +++ b/landing/fragments/landing-faq/src/faq.component.tsx @@ -21,7 +21,7 @@ export const Faq = () => { const { isMobile } = useWindowWidth() const [open, setOpen] = useState(false) - const handleModalOpen = () => setOpen(false) + const handleModalState = () => setOpen(!open) const questions = Array.from({ length: 6 }, () => Question).map((el, index) => ({ ...el, @@ -59,7 +59,7 @@ export const Faq = () => { heightIcon={48} backgroundIcon='background.white' radiiIcon='normal' - onClick={() => setOpen(true)} + onClick={handleModalState} > @@ -103,7 +103,7 @@ export const Faq = () => { heightIcon={32} backgroundIcon='background.white' radiiIcon='tiny' - onClick={() => setOpen(true)} + onClick={handleModalState} > @@ -117,7 +117,7 @@ export const Faq = () => { - + ) } diff --git a/landing/fragments/landing-faq/src/question-modal/question-modal.interfaces.ts b/landing/fragments/landing-faq/src/question-modal/question-modal.interfaces.ts index 53e4fe03..b2f5d73d 100644 --- a/landing/fragments/landing-faq/src/question-modal/question-modal.interfaces.ts +++ b/landing/fragments/landing-faq/src/question-modal/question-modal.interfaces.ts @@ -1,4 +1,6 @@ +import { MouseEventHandler } from 'react' + export interface QuestionModalProps { open: boolean - setOpen: () => void + setOpen: MouseEventHandler } diff --git a/landing/fragments/landing-navigation/src/drawer/drawer.interfaces.ts b/landing/fragments/landing-navigation/src/drawer/drawer.interfaces.ts index 31e39311..704a2798 100644 --- a/landing/fragments/landing-navigation/src/drawer/drawer.interfaces.ts +++ b/landing/fragments/landing-navigation/src/drawer/drawer.interfaces.ts @@ -1,5 +1,7 @@ +import { MouseEventHandler } from 'react' + export interface DrawerProps { active: boolean - onClose: () => void + onClose: MouseEventHandler children?: JSX.Element } diff --git a/ui/form/src/form.component.tsx b/ui/form/src/form.component.tsx index 6805ee84..8917aa3a 100644 --- a/ui/form/src/form.component.tsx +++ b/ui/form/src/form.component.tsx @@ -36,8 +36,8 @@ export const Form: FC = ({ name, send, setSend, onClose, onChange }) setPhoneNumber('') } - const handleClose = () => { - onClose() + const handleClose = (e) => { + onClose(e) setSend(false) onChange('') } @@ -62,7 +62,7 @@ export const Form: FC = ({ name, send, setSend, onClose, onChange }) maxLength={500} /> - + > - onClose: () => void + setSend: Dispatch> + onClose: MouseEventHandler onChange: (userName: string) => void } diff --git a/ui/modal/src/modal.interfaces.tsx b/ui/modal/src/modal.interfaces.tsx index f75071a5..e82b2bff 100644 --- a/ui/modal/src/modal.interfaces.tsx +++ b/ui/modal/src/modal.interfaces.tsx @@ -1,4 +1,6 @@ +import { MouseEventHandler } from 'react' + export interface ModalProps { - open?: boolean - onClose?: () => void + open: boolean + onClose: MouseEventHandler }