import { forwardRef } from 'react'; import { Modal, Popover, ModalBody, IconButton, PopoverBody, ModalOverlay, ModalContent, PopoverArrow, PopoverTrigger, PopoverContent, ModalCloseButton, PopoverCloseButton, } from '@chakra-ui/react'; import { FiSearch } from '@meronex/icons/fi'; import { If, ResolvedTarget } from '~/components'; import { useMobile } from '~/context'; import { useLGState } from '~/hooks'; import type { IconButtonProps } from '@chakra-ui/react'; import type { TSubmitButton, TRSubmitButton } from './types'; const SubmitIcon = forwardRef>( (props, ref) => { const { isLoading } = props; return ( } title="Submit Query" colorScheme="primary" isLoading={isLoading} aria-label="Submit Query" /> ); }, ); /** * Mobile Submit Button */ const MSubmitButton = (props: TRSubmitButton) => { const { children, isOpen, onClose, onChange } = props; return ( <> {children} {isOpen && } ); }; /** * Desktop Submit Button */ const DSubmitButton = (props: TRSubmitButton) => { const { children, isOpen, onClose, onChange } = props; return ( {children} {isOpen && } ); }; export const SubmitButton = (props: TSubmitButton) => { const { handleChange } = props; const { btnLoading, resolvedIsOpen, resolvedClose, resetForm } = useLGState(); const isMobile = useMobile(); function handleClose(): void { btnLoading.set(false); resetForm(); resolvedClose(); } return ( <> ); };