From 207a2540101b2f216bde94ae53286d2e52f044e3 Mon Sep 17 00:00:00 2001
From: Wolfboy248 <georgejvindkarlsen@gmail.com>
Date: Mon, 25 Nov 2024 09:20:01 +0100
Subject: frontend: begin port to css modules, sidebar refactor

---
 frontend/src/components/Login.tsx | 38 +++++++++++++++++++++++---------------
 1 file changed, 23 insertions(+), 15 deletions(-)

(limited to 'frontend/src/components/Login.tsx')

diff --git a/frontend/src/components/Login.tsx b/frontend/src/components/Login.tsx
index f1628b2..fe0cbd1 100644
--- a/frontend/src/components/Login.tsx
+++ b/frontend/src/components/Login.tsx
@@ -5,14 +5,20 @@ import { ExitIcon, UserIcon, LoginIcon } from '@images/Images';
 import { UserProfile } from '@customTypes/Profile';
 import { API } from '@api/Api';
 import "@css/Login.css";
+import { Button, Buttons } from "@customTypes/Sidebar";
+import btn from "@css/Button.module.css";
 
 interface LoginProps {
+  isSearching: boolean;
+  currentBtn: number;
+  buttonsList: Buttons;
+  setCurrentBtn: React.Dispatch<React.SetStateAction<number>>;
   setToken: React.Dispatch<React.SetStateAction<string | undefined>>;
   profile?: UserProfile;
   setProfile: React.Dispatch<React.SetStateAction<UserProfile | undefined>>;
 };
 
-const Login: React.FC<LoginProps> = ({ setToken, profile, setProfile }) => {
+const Login: React.FC<LoginProps> = ({ isSearching, currentBtn, buttonsList, setCurrentBtn, setToken, profile, setProfile }) => {
 
   const navigate = useNavigate();
 
@@ -36,13 +42,15 @@ const Login: React.FC<LoginProps> = ({ setToken, profile, setProfile }) => {
             {profile.profile ?
               (
                 <>
-                  <Link to="/profile" tabIndex={-1} className='login'>
-                    <button className='sidebar-button'>
-                      <img className="avatar-img" src={profile.avatar_link} alt="" />
+                  <Link to="/profile" tabIndex={-1}>
+					  <button onClick={() => {setCurrentBtn(buttonsList.top.length)}} id="sidebarBtn" className={`${btn.sidebar} ${btn.profile} ${currentBtn == buttonsList.top.length ? btn.selected : ""} ${isSearching ? btn.min : ""}`}>
+					  <img className="avatar-img" src={profile.avatar_link} alt="" />
+					  <span style={{justifyContent: "space-between", display: "flex", alignItems: "center", width: "100%"}}>
                       <span>{profile.user_name}</span>
-                    </button>
-                    <button className='logout-button' onClick={_logout}>
-                      <img src={ExitIcon} alt="" /><span />
+                      <button className={btn.logout} onClick={_logout}>
+                      	<img src={ExitIcon} alt="" /><span />
+					  </button>
+					</span>
                     </button>
                   </Link>
                 </>
@@ -50,8 +58,8 @@ const Login: React.FC<LoginProps> = ({ setToken, profile, setProfile }) => {
               :
               (
                 <>
-                  <Link to="/" tabIndex={-1} className='login'>
-                    <button className='sidebar-button'>
+                  <Link to="/" tabIndex={-1}>
+                    <button id="sidebarBtn" className={`${btn.sidebar} ${btn.profile} ${isSearching ? btn.min : ""}`}>
                       <img className="avatar-img" src={profile.avatar_link} alt="" />
                       <span>Loading Profile...</span>
                     </button>
@@ -66,12 +74,12 @@ const Login: React.FC<LoginProps> = ({ setToken, profile, setProfile }) => {
         )
         :
         (
-          <Link to="/api/v1/login" tabIndex={-1} className='login' >
-            <button className='sidebar-button' onClick={_login}>
-              <img className="avatar-img" src={UserIcon} alt="" />
-              <span>
-                <img src={LoginIcon} alt="Sign in through Steam" />
-              </span>
+          <Link to="/api/v1/login" tabIndex={-1}>
+            <button id="sidebarBtn" className={`${btn.sidebar} ${isSearching ? btn.min : ""}`} onClick={_login}>
+				<img className="avatar-img" src={UserIcon} alt="" />
+				<span>
+					<img src={LoginIcon} alt="Sign in through Steam" />
+				</span>
             </button>
           </Link>
         )}
-- 
cgit v1.2.3

