diff options
| author | FifthWit <fifthwitbusiness@gmail.com> | 2025-08-14 14:01:01 -0500 |
|---|---|---|
| committer | FifthWit <fifthwitbusiness@gmail.com> | 2025-08-14 14:01:01 -0500 |
| commit | 6a8b909afbe1560be95f7ad0a3e19cfe4717aec6 (patch) | |
| tree | 83cdbe3b5b7e5b83d5f0d08964634cc942264072 /frontend/src/components/Login.tsx | |
| parent | Switched to Vite as build tool (diff) | |
| download | lphub-6a8b909afbe1560be95f7ad0a3e19cfe4717aec6.tar.gz lphub-6a8b909afbe1560be95f7ad0a3e19cfe4717aec6.tar.bz2 lphub-6a8b909afbe1560be95f7ad0a3e19cfe4717aec6.zip | |
Switched to tailwind/vite
Diffstat (limited to 'frontend/src/components/Login.tsx')
| -rw-r--r-- | frontend/src/components/Login.tsx | 53 |
1 files changed, 35 insertions, 18 deletions
diff --git a/frontend/src/components/Login.tsx b/frontend/src/components/Login.tsx index 1858c48..ba85aeb 100644 --- a/frontend/src/components/Login.tsx +++ b/frontend/src/components/Login.tsx | |||
| @@ -1,18 +1,18 @@ | |||
| 1 | import React from "react"; | 1 | import React from "react"; |
| 2 | import { Link, useNavigate } from "react-router-dom"; | 2 | import { Link, useNavigate } from "react-router-dom"; |
| 3 | 3 | ||
| 4 | import { ExitIcon, UserIcon, LoginIcon } from "@images/Images"; | 4 | import { ExitIcon, UserIcon, LoginIcon } from "../images/Images"; |
| 5 | import { UserProfile } from "@customTypes/Profile"; | 5 | import { UserProfile } from "@customTypes/Profile"; |
| 6 | import { API } from "@api/Api"; | 6 | import { API } from "@api/Api"; |
| 7 | import "@css/Login.css"; | ||
| 8 | 7 | ||
| 9 | interface LoginProps { | 8 | interface LoginProps { |
| 10 | setToken: React.Dispatch<React.SetStateAction<string | undefined>>; | 9 | setToken: React.Dispatch<React.SetStateAction<string | undefined>>; |
| 11 | profile?: UserProfile; | 10 | profile?: UserProfile; |
| 12 | setProfile: React.Dispatch<React.SetStateAction<UserProfile | undefined>>; | 11 | setProfile: React.Dispatch<React.SetStateAction<UserProfile | undefined>>; |
| 12 | isOpen: boolean; | ||
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | const Login: React.FC<LoginProps> = ({ setToken, profile, setProfile }) => { | 15 | const Login: React.FC<LoginProps> = ({ setToken, profile, setProfile, isOpen }) => { |
| 16 | const navigate = useNavigate(); | 16 | const navigate = useNavigate(); |
| 17 | 17 | ||
| 18 | const _login = () => { | 18 | const _login = () => { |
| @@ -32,16 +32,16 @@ const Login: React.FC<LoginProps> = ({ setToken, profile, setProfile }) => { | |||
| 32 | <> | 32 | <> |
| 33 | {profile.profile ? ( | 33 | {profile.profile ? ( |
| 34 | <> | 34 | <> |
| 35 | <Link to="/profile" tabIndex={-1} className="login"> | 35 | <Link to="/profile" tabIndex={-1} className="grid grid-cols-[50px_auto_200px]"> |
| 36 | <button className="sidebar-button"> | 36 | <button className="grid grid-cols-[50px_auto] place-items-start text-left bg-inherit cursor-pointer border-none w-[310px] h-10 rounded-[20px] py-[0.3em] px-0 pl-[11px] transition-all duration-300"> |
| 37 | <img | 37 | <img |
| 38 | className="avatar-img" | 38 | className="rounded-[50px]" |
| 39 | src={profile.avatar_link} | 39 | src={profile.avatar_link} |
| 40 | alt="" | 40 | alt="" |
| 41 | /> | 41 | /> |
| 42 | <span>{profile.user_name}</span> | 42 | <span className="font-[--font-barlow-semicondensed-regular] text-lg text-foreground h-8 leading-7 transition-opacity duration-100 max-w-[22ch] overflow-hidden">{profile.user_name}</span> |
| 43 | </button> | 43 | </button> |
| 44 | <button className="logout-button" onClick={_logout}> | 44 | <button className="relative left-[210px] w-[50px] !pl-[10px] !bg-transparent" onClick={_logout}> |
| 45 | <img src={ExitIcon} alt="" /> | 45 | <img src={ExitIcon} alt="" /> |
| 46 | <span /> | 46 | <span /> |
| 47 | </button> | 47 | </button> |
| @@ -49,16 +49,16 @@ const Login: React.FC<LoginProps> = ({ setToken, profile, setProfile }) => { | |||
| 49 | </> | 49 | </> |
| 50 | ) : ( | 50 | ) : ( |
| 51 | <> | 51 | <> |
| 52 | <Link to="/" tabIndex={-1} className="login"> | 52 | <Link to="/" tabIndex={-1} className="grid grid-cols-[50px_auto_200px]"> |
| 53 | <button className="sidebar-button"> | 53 | <button className="grid grid-cols-[50px_auto] place-items-start text-left bg-inherit cursor-pointer border-none w-[310px] h-10 rounded-[20px] py-[0.3em] px-0 pl-[11px] transition-all duration-300"> |
| 54 | <img | 54 | <img |
| 55 | className="avatar-img" | 55 | className="rounded-[50px]" |
| 56 | src={profile.avatar_link} | 56 | src={profile.avatar_link} |
| 57 | alt="" | 57 | alt="" |
| 58 | /> | 58 | /> |
| 59 | <span>Loading Profile...</span> | 59 | <span className="font-[--font-barlow-semicondensed-regular] text-lg text-foreground h-8 leading-7 transition-opacity duration-100 max-w-[22ch] overflow-hidden">Loading Profile...</span> |
| 60 | </button> | 60 | </button> |
| 61 | <button disabled className="logout-button" onClick={_logout}> | 61 | <button disabled className="relative left-[210px] w-[50px] !pl-[10px] !bg-transparent hidden" onClick={_logout}> |
| 62 | <img src={ExitIcon} alt="" /> | 62 | <img src={ExitIcon} alt="" /> |
| 63 | <span /> | 63 | <span /> |
| 64 | </button> | 64 | </button> |
| @@ -67,11 +67,28 @@ const Login: React.FC<LoginProps> = ({ setToken, profile, setProfile }) => { | |||
| 67 | )} | 67 | )} |
| 68 | </> | 68 | </> |
| 69 | ) : ( | 69 | ) : ( |
| 70 | <Link to="/api/v1/login" tabIndex={-1} className="login"> | 70 | <Link to="/api/v1/login" tabIndex={-1}> |
| 71 | <button className="sidebar-button" onClick={_login}> | 71 | <button |
| 72 | <img className="avatar-img" src={UserIcon} alt="" /> | 72 | className={`${ |
| 73 | <span> | 73 | isOpen |
| 74 | <img src={LoginIcon} alt="Sign in through Steam" /> | 74 | ? "grid grid-cols-[50px_auto] place-items-start pl-[11px]" |
| 75 | : "flex items-center justify-center" | ||
| 76 | } text-left bg-inherit cursor-pointer border-none w-[310px] h-16 rounded-[20px] py-[0.3em] px-0 transition-all duration-300 ${isOpen ? "text-white" : "text-gray-400"}`} | ||
| 77 | onClick={_login} | ||
| 78 | > | ||
| 79 | <span className={`font-[--font-barlow-semicondensed-regular] text-lg h-12 leading-7 transition-opacity duration-100 ${isOpen ? " overflow-hidden" : ""}`}> | ||
| 80 | {isOpen ? ( | ||
| 81 | <div className="bg-neutral-800 p-2 rounded-lg w-64 flex flex-row items-center justifyt-start gap-2 font-semibold"> | ||
| 82 | <LoginIcon /> | ||
| 83 | <span> | ||
| 84 | Login with Steam | ||
| 85 | </span> | ||
| 86 | </div> | ||
| 87 | ) : ( | ||
| 88 | <div className="bg-neutral-800 p-2 rounded-lg w-"> | ||
| 89 | <LoginIcon /> | ||
| 90 | </div> | ||
| 91 | )} | ||
| 75 | </span> | 92 | </span> |
| 76 | </button> | 93 | </button> |
| 77 | </Link> | 94 | </Link> |