// LoginForm.tsx import Button from "@/components/generics/button/Button"; import Input from "@/components/generics/input/Input"; import { useAuth } from "@/shared/hooks/useAuth/useAuth"; import { useMemo, useState } from "react"; import Modal from "react-modal"; import "./LoginForm.scss"; const customStyles = { content: { top: "50%", left: "50%", right: "auto", bottom: "auto", transform: "translate(-50%, -50%)", borderRadius: "15px", width: "400px", }, }; const LoginForm = () => { const { login, isAuth } = useAuth(); const [value, setValue] = useState(""); const [error, setError] = useState(null); const rules = useMemo( () => [ { rule: (newValue: string) => newValue.trim().length >= 5, errorMessage: "Пожалуйста, введите имя пользователя длиной не менее 5 символов", }, ], [] ); const onSetValue = (newValue: string) => { if (newValue.length <= 65) { setValue(newValue); } }; const onSetError = (newError: string | null) => { setError(newError); }; const handleLogin = () => { if (error == null) { login({ name: value.trim() }); } }; return (

Введите ваше имя

); }; export default LoginForm;