From 68a74771f3c3d0a5cf18bc597bdc83557f050524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D1=82=D0=B0=D0=BB=D0=B8=D0=B9=20=D0=9B=D0=B0?= =?UTF-8?q?=D0=B2=D1=88=D0=BE=D0=BD=D0=BE=D0=BA?= <114582703+valavshonok@users.noreply.github.com> Date: Sun, 26 Oct 2025 07:08:47 +0300 Subject: [PATCH] layout auth page --- src/assets/icons/input/eye-closed.svg | 3 + src/assets/icons/input/eye-open.png | Bin 0 -> 662 bytes src/assets/icons/input/eye-open.svg | 3 + src/assets/icons/input/google-logo.svg | 13 ++ src/assets/icons/input/index.ts | 5 + src/components/button/PrimaryButton.tsx | 3 +- src/components/button/SecondaryButton.tsx | 3 +- src/components/checkbox/Checkbox.tsx | 2 +- src/components/input/Input.tsx | 160 ++++++---------------- src/views/home/auth/Login.tsx | 95 +++++++------ src/views/home/auth/Register.tsx | 148 ++++++++------------ 11 files changed, 174 insertions(+), 261 deletions(-) create mode 100644 src/assets/icons/input/eye-closed.svg create mode 100644 src/assets/icons/input/eye-open.png create mode 100644 src/assets/icons/input/eye-open.svg create mode 100644 src/assets/icons/input/google-logo.svg create mode 100644 src/assets/icons/input/index.ts diff --git a/src/assets/icons/input/eye-closed.svg b/src/assets/icons/input/eye-closed.svg new file mode 100644 index 0000000..a3a57eb --- /dev/null +++ b/src/assets/icons/input/eye-closed.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icons/input/eye-open.png b/src/assets/icons/input/eye-open.png new file mode 100644 index 0000000000000000000000000000000000000000..eee56902b013ac2b35bc2d8edcddd0e9e148884e GIT binary patch literal 662 zcmeAS@N?(olHy`uVBq!ia0y~yV2}V|4mJh`h6m-gKNuJoI14-?iy0WWg+Z8+Vb&aw z3dZ6fcPEB*=VV?oFfg#BJNh~@Fl_AS{*%bcz`&&K>Eakt!T2`hcH!j!fxCOV=Ke5E zc0R;YzldoHp9|{@J|ET#j!x_Wj0>4AIZoj+5RIrY6tRg7H3twa>%=sJl{>yx>GtDpd zI$1CsQOs$d{o={t&2|5utmpE$-h6lU`kW1$^IpoB&Jmhaz4%JVwXzCzEk$n8eT!?t z-@K2BKYaW7;y!NQA1{wTOBFf)L$UwKcBW8``HXWjndAik`vTSITm`?l-arJ-L26lRE8huaKi6vU-c}}!> zw!=z0@aEk$VGj+jJj`n_b#+k<$`E7`o^RGZTlIX>Qo#(T$gG_r>IM8yVy5t?hdzo3 zZ`t|JXG*LnPx$12hbEVD6wZ`5cFAK>q7{4U9=&xUEOV4D&E~zAcsf;GMw`|BXzXPc zNi)W}pu2nfmHz~XMz7Cql#%mOs@fj0;?Q23Ia8MDBp!e8dY9fuWjVe&W^ + + diff --git a/src/assets/icons/input/google-logo.svg b/src/assets/icons/input/google-logo.svg new file mode 100644 index 0000000..c3a4960 --- /dev/null +++ b/src/assets/icons/input/google-logo.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/assets/icons/input/index.ts b/src/assets/icons/input/index.ts new file mode 100644 index 0000000..d8a755a --- /dev/null +++ b/src/assets/icons/input/index.ts @@ -0,0 +1,5 @@ +import eyeClosed from "./eye-closed.svg" +import eyeOpen from "./eye-open.png" +import googleLogo from "./google-logo.svg" + +export {eyeClosed, eyeOpen, googleLogo} \ No newline at end of file diff --git a/src/components/button/PrimaryButton.tsx b/src/components/button/PrimaryButton.tsx index 970fd00..a90b90f 100644 --- a/src/components/button/PrimaryButton.tsx +++ b/src/components/button/PrimaryButton.tsx @@ -21,7 +21,6 @@ export const PrimaryButton: React.FC = ({ disabled && "pointer-events-none", className )} - onClick={() => onClick()} > {/* Основной контейнер, */}
= ({ "[&:focus-visible+*]:outline-liquid-brightmain", )} disabled={disabled} - onClick={() => {}} + onClick={() => {onClick()}} /> {/* Граница при выделении через tab */} diff --git a/src/components/button/SecondaryButton.tsx b/src/components/button/SecondaryButton.tsx index d9d9ad3..244809f 100644 --- a/src/components/button/SecondaryButton.tsx +++ b/src/components/button/SecondaryButton.tsx @@ -21,7 +21,6 @@ export const SecondaryButton: React.FC = ({ disabled && "pointer-events-none", className )} - onClick={() => onClick()} > {/* Основной контейнер, */}
= ({ "[&:focus-visible+*]:outline-liquid-brightmain", )} disabled={disabled} - onClick={() => {}} + onClick={() => {onClick()}} /> {/* Граница при выделении через tab */} diff --git a/src/components/checkbox/Checkbox.tsx b/src/components/checkbox/Checkbox.tsx index 05632d6..0153384 100644 --- a/src/components/checkbox/Checkbox.tsx +++ b/src/components/checkbox/Checkbox.tsx @@ -105,7 +105,7 @@ export const Checkbox: React.FC = ({ >
void; + defaultState?: string; } -export const Input: React.FC = ({ - size = "sm", - // radius = "md", +export const Input: React.FC = ({ type = "text", - id = "", + error = "", disabled = false, required = false, - // color = "default", label = "", - labelType = "in", placeholder = "", - variant = "bordered", - className, + className = "", onChange, defaultState = "", }) => { const [value, setValue] = React.useState(defaultState); + const [visible, setVIsible] = React.useState(type != "password"); React.useEffect(() => onChange(value), [value]); - if (labelType == "in" || labelType == "in-fixed") - return ( - - ); +
+ {error} +
+ +
+ ); - return <>; }; diff --git a/src/views/home/auth/Login.tsx b/src/views/home/auth/Login.tsx index c73b7b3..b1803be 100644 --- a/src/views/home/auth/Login.tsx +++ b/src/views/home/auth/Login.tsx @@ -2,11 +2,12 @@ import { useState, useEffect } from "react"; import { PrimaryButton } from "../../../components/button/PrimaryButton"; import { Input } from "../../../components/input/Input"; import { useAppDispatch, useAppSelector } from "../../../redux/hooks"; -import { useNavigate } from "react-router-dom"; +import { Link, useNavigate } from "react-router-dom"; import { loginUser } from "../../../redux/slices/auth"; import { cn } from "../../../lib/cn"; import { setMenuActivePage } from "../../../redux/slices/store"; import { Balloon } from "../../../assets/icons/auth"; +import { SecondaryButton } from "../../../components/button/SecondaryButton"; const Login = () => { const dispatch = useAppDispatch(); @@ -18,6 +19,9 @@ const Login = () => { const { status, error, jwt } = useAppSelector((state) => state.auth); + + const [err, setErr] = useState(""); + // После успешного логина useEffect(() => { dispatch(setMenuActivePage("account")) @@ -27,6 +31,8 @@ const Login = () => { }, [jwt]); const handleLogin = () => { + setErr(err == "" ? "Неверная почта и/или пароль" : ""); + console.log(123); setSubmitClicked(true); if (!username || !password) return; @@ -39,67 +45,60 @@ const Login = () => { }; return ( -
-
-
+
+
+
-
-
- Вход в аккаунт -
-
- Для начала работы войдите в аккаунт. Заполните поля ниже и нажмите "Войти". -
- -
-
- Поле не может быть пустым +
+
+
+ С возвращением
- setUsername(val)} - /> - -
- Поле не может быть пустым +
+ Вход в аккаунт
- setPassword(val)} - /> - - {status === "failed" && error && ( -
{error}
- )}
-
+ + { }} placeholder="example@gmail.com" error={err}/> + { }} placeholder="abCD1234" /> + +
+ + Забыли пароль? + +
+ + +
-
+ + + +
+ + Нет аккаунта? + Регистрация + + + +
diff --git a/src/views/home/auth/Register.tsx b/src/views/home/auth/Register.tsx index fb5c38e..fe9bdac 100644 --- a/src/views/home/auth/Register.tsx +++ b/src/views/home/auth/Register.tsx @@ -3,10 +3,14 @@ import { PrimaryButton } from "../../../components/button/PrimaryButton"; import { Input } from "../../../components/input/Input"; import { useAppDispatch, useAppSelector } from "../../../redux/hooks"; import { useNavigate } from "react-router-dom"; -import { registerUser } from "../../../redux/slices/auth"; // 👈 новый экшен +import { registerUser } from "../../../redux/slices/auth"; import { cn } from "../../../lib/cn"; import { setMenuActivePage } from "../../../redux/slices/store"; import { Balloon } from "../../../assets/icons/auth"; +import { Link } from "react-router-dom"; +import { SecondaryButton } from "../../../components/button/SecondaryButton"; +import { Checkbox } from "../../../components/checkbox/Checkbox"; + const Register = () => { const dispatch = useAppDispatch(); @@ -42,114 +46,72 @@ const Register = () => { }; return ( -
-
-
+
+
+
-
-
- Регистрация -
-
- Создайте учетную запись, заполнив поля ниже и нажав "Зарегистрироваться". +
+
+
+ Добро пожаловать +
+
+ Регистрация +
-
- {/* Username */} -
- Поле не может быть пустым -
- setUsername(val)} - /> - {/* Email */} -
- Поле не может быть пустым -
- setEmail(val)} - /> + { }} placeholder="example@gmail.com" /> + { }} placeholder="login" /> + { }} placeholder="abCD1234" /> + { }} placeholder="abCD1234" /> - {/* Password */} -
- Поле не может быть пустым -
- setPassword(val)} - /> +
+ { console.log(value) }} + className="p-0 w-fit m-[2.75px]" + size="md" + color="secondary" + variant="default" /> + + Я принимаю + политику конфиденциальности + + - {/* Confirm Password */} -
- {submitClicked && password !== confirmPassword - ? "Пароли не совпадают" - : "Поле не может быть пустым"} -
- setConfirmPassword(val)} - /> - - {/* Ошибка с сервера */} - {status === "failed" && error && ( -
{error}
- )}
-
+
{ }} + text={status === "loading" ? "Регистрация..." : "Регистрация"} disabled={status === "loading"} /> - { }} + text="Регистрация с Google " />
+ + +
+ + Уже есть аккаунт? + Авторизация + + + +
+
);