Skip to content

Commit

Permalink
Merge pull request #45 from NUS-Fintech-Society/fix/DEV-4-quickfix
Browse files Browse the repository at this point in the history
Fix/dev 4 quickfix
  • Loading branch information
gnimnix authored May 23, 2024
2 parents 30f32ce + 01f431f commit d7a1c5c
Show file tree
Hide file tree
Showing 11 changed files with 242 additions and 7,028 deletions.
6,742 changes: 0 additions & 6,742 deletions package-lock.json

This file was deleted.

38 changes: 0 additions & 38 deletions src/assets/css/layout.tsx

This file was deleted.

1 change: 1 addition & 0 deletions src/assets/css/reset.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ html {
-moz-text-size-adjust: none;
-webkit-text-size-adjust: none;
text-size-adjust: none;
font-family: 'DM Sans', sans-serif;
}

/* Reapply the pointer cursor for anchor tags */
Expand Down
23 changes: 12 additions & 11 deletions src/assets/css/shared/NavBar.module.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
.overallHeader {
display: flex;
display: none;
justify-content: space-between;
background-color: #0C1747;
align-items: center;
overflow: hidden;
width: 100%;
position: fixed;
top: 0;
font-family: 'DM Sans', sans-serif;
top: 0;
height: 98px;

}

.overallHeader div a {
Expand All @@ -23,7 +21,7 @@
}

.overallHeader div a:hover {
color:#F9A72B;
color: #F9A72B;
}

.personLogo {
Expand All @@ -32,7 +30,7 @@
padding-right: 44px;
}

.fintechLogo{
.fintechLogo {
max-width: 146px;
height: auto;
}
Expand All @@ -41,28 +39,25 @@
position: fixed;
top: 100px;
right: 12px;
font-size: px;
font-size: 16px;
background-color: rgb(255, 255, 255);
box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.1);
z-index: 1001;
width: 158px;
height: 116;
align-items: center;
justify-content: center;
display: flex;
text-align: center;
flex-direction: column;
font-family: 'DM Sans', sans-serif;
font-weight: 400;
}

.profileOption,
.signOutOption {
padding: 0px;
padding: 0;
width: 100%;
text-decoration: none;
color: black !important;
font-family: 'DM Sans', sans-serif;
font-weight: 400;
}

Expand All @@ -74,3 +69,9 @@
.personIconContainer {
height: 100px;
}

@media screen and (min-width: 992px) {
.overallHeader {
display: flex;
}
}
7 changes: 2 additions & 5 deletions src/assets/css/shared/NavBarMobile.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
overflow: hidden;
width: 100%;
position: fixed;
top: 0;
font-family: 'DM Sans', sans-serif;
top: 0;
height: 100px;
}

Expand Down Expand Up @@ -47,7 +46,6 @@
width: 100%;
height: 100%;
flex-direction: column;
font-family: 'DM Sans', sans-serif;
}

.sidebar div a {
Expand All @@ -57,8 +55,7 @@
text-decoration: none;
align-items: center;
font-size: 30px;
padding: 10px;
padding-left: 44px;
padding: 10px 10px 10px 44px;
font-weight: 500;
}

Expand Down
25 changes: 25 additions & 0 deletions src/components/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from "react";
import Navbar from "components/shared/NavBar"; // Import the Navbar component.
import NavBarMobile from "components/shared/NavBarMobile.tsx";
import { useWindowSize } from "@uidotdev/usehooks";
import { BREAKPOINTS } from "components/constants.tsx";

interface LayoutProps {
children?: React.ReactNode;
}

const DefaultLayout: React.FC<LayoutProps> = ({ children=null }) => {
const size = useWindowSize();
return (
<>
{size.width && size.width <= BREAKPOINTS.LG ? (
<NavBarMobile />
) : (
<Navbar />
)}
{children}
</>
);
};

export default DefaultLayout;
127 changes: 59 additions & 68 deletions src/components/shared/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ import { Link } from "react-router-dom";
import styles from "css/shared/NavBar.module.css"; // Assuming you have CSS modules set up
import personLogo from "/person_logo.png";
import fintechLogo from "/fintech_logo.png";
import { useWindowSize } from "@uidotdev/usehooks";
import NavBarMobile from "./NavBarMobile.tsx";

function Navbar() {
const [showProfileOptions, setShowProfileOptions] = useState(false);
const size = useWindowSize(); // Get window size

const handleProfileHover = () => {
setShowProfileOptions(true);
Expand All @@ -20,76 +17,70 @@ function Navbar() {
};

return (
<>
{size.width && size.width < 767 ? (
<NavBarMobile />
) : (
<div>
<div className={styles.overallHeader}>
<div>
<div className={styles.overallHeader}>
<div>
<a href="/public">
<img
src={fintechLogo}
alt="fintech Logo"
className={styles.fintechLogo}
/>
</a>
</div>
<div>
<Link to="/announcements" className={styles.Link}>
Announcements
</Link>
</div>
<div>
<Link to="/members" className={styles.Link}>
Members
</Link>
</div>
<div>
<Link to="/events" className={styles.Link}>
Events
</Link>
</div>
<div>
<Link to="/tasks" className={styles.Link}>
Tasks
</Link>
</div>
<div>
<Link to="/" className={styles.Link}>
Attendance
<a href="/public">
<img
src={fintechLogo}
alt="fintech Logo"
className={styles.fintechLogo}
/>
</a>
</div>
<div>
<Link to="/announcements" className={styles.Link}>
Announcements
</Link>
</div>
<div>
<Link to="/members" className={styles.Link}>
Members
</Link>
</div>
<div>
<Link to="/events" className={styles.Link}>
Events
</Link>
</div>
<div>
<Link to="/tasks" className={styles.Link}>
Tasks
</Link>
</div>
<div>
<Link to="/" className={styles.Link}>
Attendance
</Link>
</div>
<div>
<Link to="/recruitment" className={styles.Link}>
Recruitment
</Link>
</div>
<div
onMouseEnter={handleProfileHover}
onMouseLeave={handleProfileLeave}
className={styles.personIconContainer}
>
<img
src={personLogo}
alt="Person Logo"
className={styles.personLogo}
/>
{showProfileOptions && (
<div className={styles.profileOptions}>
<Link to="/profile" className={styles.profileOption}>
Profile
</Link>
</div>
<div>
<Link to="/recruitment" className={styles.Link}>
Recruitment
<Link to="/signout" className={styles.signOutOption}>
Sign Out
</Link>
</div>
<div
onMouseEnter={handleProfileHover}
onMouseLeave={handleProfileLeave}
className={styles.personIconContainer}
>
<img
src={personLogo}
alt="Person Logo"
className={styles.personLogo}
/>
{showProfileOptions && (
<div className={styles.profileOptions}>
<Link to="/profile" className={styles.profileOption}>
Profile
</Link>
<Link to="/signout" className={styles.signOutOption}>
Sign Out
</Link>
</div>
)}
</div>
</div>
)}
</div>
)}
</>
</div>
</div>
);
}

Expand Down
26 changes: 8 additions & 18 deletions src/components/shared/NavBarMobile.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
import { useState } from "react";
import { Link } from "react-router-dom";
import styles from "css/shared/NavBarMobile.module.css"; // Import CSS module
import styles from "css/shared/NavBarMobile.module.css";
import { useToggle } from "@uidotdev/usehooks";
import personLogo from "/person_logo.png";
import fintechLogo from "/fintech_logo.png";
import closeSymbol from "/material-symbols_close.png";

function NavBarMobile() {
const [showSideBar, setShowSideBar] = useState(false);

const toggleSideBar = () => {
setShowSideBar(true);
};

const closeSideBar = () => {
setShowSideBar(false);
};
const [showSideBar, toggleSideBar] = useToggle(false);

return (
<header>
Expand All @@ -23,31 +15,29 @@ function NavBarMobile() {
<img
src={fintechLogo}
alt="fintech Logo"
className={styles.fintechLogo} // Use curly braces to evaluate the variable
onClick={toggleSideBar}
className={styles.fintechLogo}
/>
</div>
<div>
{showSideBar ? (
<img
src={closeSymbol}
alt="Close Logo"
className={styles.closeLogo} // Use curly braces to evaluate the variable
onClick={closeSideBar}
className={styles.closeLogo}
onClick={() => toggleSideBar(false)}
/>
) : (
<img
src={personLogo}
alt="Person Logo"
className={styles.personLogo} // Use curly braces to evaluate the variable
className={styles.personLogo}
onClick={() => toggleSideBar(true)}
/>
)}
</div>
</div>
{showSideBar && (
<div className={styles.sidebar}>
{" "}
{/* Use curly braces to evaluate the variable */}
<div>
<Link to="/" className={styles.Link}>
Home
Expand Down
Loading

0 comments on commit d7a1c5c

Please sign in to comment.