import React, { useRef } from 'react'; import { FileUpload, TooltipAnchor } from '~/components/ui'; import { AttachmentIcon } from '~/components/svg'; import { useLocalize } from '~/hooks'; import { cn } from '~/utils'; const AttachFile = ({ isRTL, disabled, handleFileChange, }: { isRTL: boolean; disabled?: boolean | null; handleFileChange: (event: React.ChangeEvent) => void; }) => { const localize = useLocalize(); const inputRef = useRef(null); const isUploadDisabled = disabled ?? false; return ( { if (!inputRef.current) { return; } if (e.key === 'Enter' || e.key === ' ') { inputRef.current.value = ''; inputRef.current.click(); } }} onClick={() => { if (!inputRef.current) { return; } inputRef.current.value = ''; inputRef.current.click(); }} >
); }; export default React.memo(AttachFile);