From 3fcddf2d2036936d1f4e818f9471a8c3a4502b69 Mon Sep 17 00:00:00 2001 From: Wind-Explorer Date: Sat, 8 Feb 2025 22:09:30 +0800 Subject: [PATCH] signup & login UI --- .../src/components/LoginView.tsx | 48 +++++++++++++ .../src/components/NavigationBar.tsx | 43 ++++++++++- .../src/components/SignupView.tsx | 72 +++++++++++++++++++ AceJobAgency.client/src/pages/HomePage.tsx | 61 +++++++++++++++- 4 files changed, 219 insertions(+), 5 deletions(-) create mode 100644 AceJobAgency.client/src/components/LoginView.tsx create mode 100644 AceJobAgency.client/src/components/SignupView.tsx diff --git a/AceJobAgency.client/src/components/LoginView.tsx b/AceJobAgency.client/src/components/LoginView.tsx new file mode 100644 index 0000000..a5a41fc --- /dev/null +++ b/AceJobAgency.client/src/components/LoginView.tsx @@ -0,0 +1,48 @@ +import { Input, Checkbox, Button, Link } from "@heroui/react"; +import { IconMail, IconLock } from "@tabler/icons-react"; + +export default function LoginView({ onSignup }: { onSignup: () => void }) { + return ( +
+
+

Welcome back!

+

+ Let us know who you are, and we will let you in. +

+
+
+ } label="Email" /> + } label="Password" type="password" /> +
+
+ + Remember me + + + Forgot password? + +
+
+ +
+

Don't have an account?

+ { + onSignup(); + }} + className="text-sm" + > + Sign up + +
+
+
+ ); +} diff --git a/AceJobAgency.client/src/components/NavigationBar.tsx b/AceJobAgency.client/src/components/NavigationBar.tsx index 8ba3089..2cf572b 100644 --- a/AceJobAgency.client/src/components/NavigationBar.tsx +++ b/AceJobAgency.client/src/components/NavigationBar.tsx @@ -1,15 +1,26 @@ import { Button, Link, + Modal, + ModalBody, + ModalContent, + ModalHeader, + ModalFooter, Navbar, NavbarBrand, NavbarContent, NavbarItem, + useDisclosure, } from "@heroui/react"; +import { useState } from "react"; import { useNavigate } from "react-router-dom"; +import SignupView from "./SignupView"; +import LoginView from "./LoginView"; export default function NavigationBar() { const navigate = useNavigate(); + const { isOpen, onOpen, onOpenChange } = useDisclosure(); + const [isSignup, setIsSignup] = useState(false); return ( @@ -32,7 +43,8 @@ export default function NavigationBar() { + + + {() => ( + <> + + + {isSignup ? ( + { + setIsSignup(false); + }} + email="" + /> + ) : ( + { + setIsSignup(true); + }} + /> + )} + + + + )} + + ); } diff --git a/AceJobAgency.client/src/components/SignupView.tsx b/AceJobAgency.client/src/components/SignupView.tsx new file mode 100644 index 0000000..5c3843f --- /dev/null +++ b/AceJobAgency.client/src/components/SignupView.tsx @@ -0,0 +1,72 @@ +import { + Input, + Button, + Link, + Select, + SelectItem, + DatePicker, +} from "@heroui/react"; +import { IconMail, IconLock } from "@tabler/icons-react"; +import { useState } from "react"; + +export default function SignupView({ + onLogin, + email = "", +}: { + onLogin: () => void; + email: string; +}) { + const [emailValue, setEmailValue] = useState(email); + return ( +
+
+

Welcome!

+

Become a membership today!

+
+
+
+ + +
+ } + label="Email" + type="email" + value={emailValue} + onValueChange={setEmailValue} + /> + +
+ + +
+ } label="Password" type="password" /> + } + label="Confirm password" + type="password" + /> +
+
+ +
+

Already have an account?

+ { + onLogin(); + }} + className="text-sm" + > + Login + +
+
+
+ ); +} diff --git a/AceJobAgency.client/src/pages/HomePage.tsx b/AceJobAgency.client/src/pages/HomePage.tsx index 1fb337d..b4d6de1 100644 --- a/AceJobAgency.client/src/pages/HomePage.tsx +++ b/AceJobAgency.client/src/pages/HomePage.tsx @@ -1,6 +1,23 @@ -import { Button, Card, Input } from "@heroui/react"; +import { + Button, + Card, + Input, + Modal, + ModalBody, + ModalContent, + ModalFooter, + ModalHeader, + useDisclosure, +} from "@heroui/react"; +import { useState } from "react"; +import LoginView from "../components/LoginView"; +import SignupView from "../components/SignupView"; export default function HomePage() { + const { isOpen, onOpen, onOpenChange } = useDisclosure(); + const [isSignup, setIsSignup] = useState(false); + const [emailValue, setEmailValue] = useState(""); + return (
@@ -16,13 +33,51 @@ export default function HomePage() {
- -
+ + + {() => ( + <> + + + {isSignup ? ( + { + setIsSignup(false); + }} + email={emailValue} + /> + ) : ( + { + setIsSignup(true); + }} + /> + )} + + + + )} + + ); }