import { Button, PasswordInput, Stack, Text } from "@mantine/core"; import { ModalsContextProps } from "@mantine/modals/lib/context"; import { useState } from "react"; import { FormattedMessage } from "react-intl"; import useTranslate, { translateOutsideContext, } from "../../hooks/useTranslate.hook"; const showEnterPasswordModal = ( modals: ModalsContextProps, submitCallback: (password: string) => Promise, ) => { const t = translateOutsideContext(); return modals.openModal({ closeOnClickOutside: false, withCloseButton: false, closeOnEscape: false, title: t("share.modal.password.title"), children: , }); }; const Body = ({ submitCallback, }: { submitCallback: (password: string) => Promise; }) => { const [password, setPassword] = useState(""); const [passwordWrong, setPasswordWrong] = useState(false); const t = useTranslate(); return (
{ e.preventDefault(); submitCallback(password); }} > setPasswordWrong(false)} onChange={(e) => setPassword(e.target.value)} value={password} />
); }; export default showEnterPasswordModal;