diff --git a/enshi/src/Pages/LoginRegisterPage/LoginElement/LoginElement.tsx b/enshi/src/Pages/LoginRegisterPage/LoginElement/LoginElement.tsx new file mode 100644 index 0000000..650fe85 --- /dev/null +++ b/enshi/src/Pages/LoginRegisterPage/LoginElement/LoginElement.tsx @@ -0,0 +1,165 @@ +import * as Form from "@radix-ui/react-form"; +import { CrossCircledIcon } from "@radix-ui/react-icons"; +import { Button, Card, Heading, Text, TextField } from "@radix-ui/themes"; +import { useEffect, useState } from "react"; +import ShowPasswordButton from "../ShowPasswordButton/ShowPasswordButton"; + +export default function LoginElement() { + const [showPassword, setShowPassword] = useState(false); + const [isCapsLockOn, setIsCapsLockOn] = useState(false); + + useEffect(() => { + const f = (e: KeyboardEvent) => { + if (e.getModifierState("CapsLock")) { + setIsCapsLockOn(true); + } else { + setIsCapsLockOn(false); + } + }; + + document.addEventListener("keydown", f); + + return () => { + document.removeEventListener("keydown", f); + }; + }, []); + + return ( + + + Log in form + + + +
+ + Username + + + Please enter your username + +
+ + + + {(validity) => ( + + + + )} + + + +
+ + +
+ + Password + + + Please enter your password + +
+ + + + {(validity) => ( + + + + )} + + + + +
+ + {/* +
+ + Confirm password + + + Please enter your password + + + value !== formData.get("password") + } + > + Passwords must be the same + +
+ + + + {(validity) => ( + + + + )} + + + +
*/} + + + + +
+
+ ); +} diff --git a/enshi/src/Pages/LoginRegisterPage/LoginRegisterPage.tsx b/enshi/src/Pages/LoginRegisterPage/LoginRegisterPage.tsx new file mode 100644 index 0000000..ebe5a7a --- /dev/null +++ b/enshi/src/Pages/LoginRegisterPage/LoginRegisterPage.tsx @@ -0,0 +1,10 @@ +import { useState } from "react"; +import LoginElement from "./LoginElement/LoginElement"; + +export default function LoginRegisterPage() { + const [isRegister, setIsRegister] = useState(false) + + return ( + + ) +} \ No newline at end of file diff --git a/enshi/src/Pages/LoginRegisterPage/ShowPasswordButton/ShowPasswordButton.tsx b/enshi/src/Pages/LoginRegisterPage/ShowPasswordButton/ShowPasswordButton.tsx new file mode 100644 index 0000000..e7bd092 --- /dev/null +++ b/enshi/src/Pages/LoginRegisterPage/ShowPasswordButton/ShowPasswordButton.tsx @@ -0,0 +1,40 @@ +import { EyeClosedIcon, EyeOpenIcon } from "@radix-ui/react-icons"; +import { IconButton, Tooltip } from "@radix-ui/themes"; +import { Dispatch, SetStateAction } from "react"; + +type TShowPasswordButton = { + isShown: boolean; + setIsShown: Dispatch>; +}; + +export default function ShowPasswordButton({ isShown, setIsShown }: TShowPasswordButton) { + return ( +
+ + {isShown ? ( + { + setIsShown(!isShown); + }} + size={"1"} + className="rounded-full" + variant="soft" + > + + + ) : ( + setIsShown(!isShown)} + size={"1"} + className="rounded-full" + variant="soft" + > + + + )} + +
+ ); +} \ No newline at end of file diff --git a/enshi/src/routes/routes.tsx b/enshi/src/routes/routes.tsx index 8331bbb..06d4356 100644 --- a/enshi/src/routes/routes.tsx +++ b/enshi/src/routes/routes.tsx @@ -1,6 +1,7 @@ -import { createRoutesFromElements, Route, useRouteError } from "react-router-dom" -import MainPage from "../Pages/MainPage/MainPage" -import {Text} from "@radix-ui/themes"; +import { Text } from "@radix-ui/themes"; +import { createRoutesFromElements, Route, useRouteError } from "react-router-dom"; +import LoginRegisterPage from "../Pages/LoginRegisterPage/LoginRegisterPage"; +import MainPage from "../Pages/MainPage/MainPage"; function ErrorBoundary() { @@ -23,5 +24,13 @@ export const routes = createRoutesFromElements( element={Cringer path, but this a} > + + } + element={} + > + + ) \ No newline at end of file