diff --git a/packages/client/src/assets/images/login-page-sidebar.png b/packages/client/src/assets/images/login-page-sidebar.png new file mode 100644 index 0000000..bd818d4 Binary files /dev/null and b/packages/client/src/assets/images/login-page-sidebar.png differ diff --git a/packages/client/src/pages/Profile/Profile.scss b/packages/client/src/pages/Profile/Profile.scss index 24b6677..86a137c 100644 --- a/packages/client/src/pages/Profile/Profile.scss +++ b/packages/client/src/pages/Profile/Profile.scss @@ -24,7 +24,7 @@ display: flex; &__profile-container { - background-image: $img_profile_background_left; + background-image: $img_page_background_left; background-repeat: no-repeat; background-position: right bottom; position: relative; diff --git a/packages/client/src/pages/SignIn/SignIn.scss b/packages/client/src/pages/SignIn/SignIn.scss new file mode 100644 index 0000000..0afc8fc --- /dev/null +++ b/packages/client/src/pages/SignIn/SignIn.scss @@ -0,0 +1,6 @@ +@import '../../scss/form-mixin'; + +.login-page { + @include page-background-layout(); + @include form-styles(); +} diff --git a/packages/client/src/pages/SignIn/SignIn.tsx b/packages/client/src/pages/SignIn/SignIn.tsx index f0d4f48..c928a9c 100644 --- a/packages/client/src/pages/SignIn/SignIn.tsx +++ b/packages/client/src/pages/SignIn/SignIn.tsx @@ -1,70 +1,84 @@ -import { useState } from 'react' +import './SignIn.scss' +import React, { useState } from 'react' import { useAppDispatch } from '@/store' import { signInUser } from '@/store/reducers/auth-reducer' import { Button } from '@/components/ui/Button/Button' -import { useSearchParams } from 'react-router-dom' +import { Link } from 'react-router-dom' import { useNavigate } from 'react-router-dom' -import { toast } from 'react-toastify' +import { Form } from '@/components/ui/Form/Form' +import { Input } from '@/components/ui/Input/Input' +import { CustomPageTitle } from '@/components/ui/CustomPageTitle/CustomPageTitle' +import SiteLogo from '@/assets/images/site-logo.svg' export const SignIn = () => { - const [form, setForm] = useState({ login: '', password: '' }) - const [searchParams] = useSearchParams() - const [query] = useState(searchParams.get('redirectUrl')) + const [userData, setUserData] = useState({ login: '', password: '' }) + const [error, setError] = useState(null) const navigate = useNavigate() const dispatch = useAppDispatch() - const handleForm = (name: string, value: string) => { - setForm({ ...form, [name]: value }) - } + const handleInputChange = + (field: string) => (event: React.ChangeEvent) => { + setUserData(prevData => ({ + ...prevData, + [field]: event.target.value, + })) + } const handleSubmit = () => { - dispatch(signInUser({ form: form, query: query })) + dispatch(signInUser({ form: userData })) .unwrap() .then(() => { navigate('/game') }) - .catch((error?: any, code?: any) => { - toast.error(error.reason) + .catch((_error?: any, _code?: any) => { + setError('Ошибка входа в аккаунт!') }) } return ( - <> -
{ - e.preventDefault() - }}> - - -