Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sidebar and Header Bar #27

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
738d6b1
added dummy profile photo
kohrachel Dec 20, 2024
5fe8601
Added support for Poppins text (typography)
kohrachel Dec 20, 2024
2e69379
installed React Router + Lucide + some misc packages (sorry for the i…
kohrachel Dec 20, 2024
33e0808
preliminary sidebar done, see AppRoutes.tsx for proper vertical align…
kohrachel Dec 20, 2024
c9e1649
fixed image location
kohrachel Dec 20, 2024
622f186
scrappy working somewhat responsive header bar
kohrachel Dec 20, 2024
a2cd063
sidebar height responsive to the height of the contents, need to fix …
kohrachel Dec 20, 2024
d2b11bf
forgot letter s on podcasts
kohrachel Dec 20, 2024
100891c
header bar: cleaned up code + added color change on hover
kohrachel Dec 20, 2024
e99d348
sidebar: checkpoint, cleaned up code + added color change on hover. n…
kohrachel Dec 20, 2024
45ec68b
sidebar: fixed minor bug with hover color change
kohrachel Dec 20, 2024
7c610f7
sidebar: fixed hover & active tab color highlighting
kohrachel Dec 21, 2024
0a3f14e
sidebar: make clicking on menu items more intuitive (bigger clickable…
kohrachel Dec 21, 2024
a5d117c
sidebar: added an orange rectangle active tab highlighter on the righ…
kohrachel Dec 21, 2024
a5643c3
header bar: rudimentary header bar complete (rachel will continue to …
kohrachel Dec 21, 2024
05a38c6
sidebar: no more lil ghosty
kohrachel Dec 21, 2024
cccf37e
gen: AppRoutes to show how components were displayed. Feel free to re…
kohrachel Dec 21, 2024
8a4c661
very messy atp but wanted a checkpoint
kohrachel Jan 10, 2025
17211b7
i have coding standards omg 👆🤓
kohrachel Jan 11, 2025
14a5ad1
sidebar: some progress, have conditional rendering of logout button b…
kohrachel Jan 13, 2025
24ce507
sidebar: sidebar done! 🎉 has conditional rendering of login button + …
kohrachel Jan 13, 2025
bfcabc5
sidebar: fixed logout active tab highlighting
kohrachel Jan 13, 2025
cf59ac1
sidebar: sample use in appRoutes
kohrachel Jan 13, 2025
c0cc3e5
header bar: added function to display header items
kohrachel Jan 13, 2025
9daf3c6
header bar: abstracted out logo and items properly
kohrachel Jan 13, 2025
0e9733e
sidebar: caught minor typos
kohrachel Jan 13, 2025
c620b02
sidebar: v1 complete 🎉🎉🎉
kohrachel Jan 13, 2025
0e3dff2
header bar: v1 complete 🎉🎉🎉
kohrachel Jan 13, 2025
3fff827
v1: sidebar & header bar done! 🎉🎉🎉 see appRoutes for implementation. …
kohrachel Jan 13, 2025
615cc88
sike forgot to check if user was logged in
kohrachel Jan 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added frontend/public/assets/fostersource-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap"
rel="stylesheet"
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
Expand Down
73 changes: 73 additions & 0 deletions frontend/src/components/headerBar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
.header {
width: 100%;
height: 4rem;
display: flex;
flex: 1;
flex-direction: row;
background-color: white;
align-items: center;
transition: height 0.3s;
}

.header-image {
height: 45px;
margin-left: 12rem;
margin-right: 12rem;
transition: margin 0.3s;
}

.header-menu {
display: flex;
flex: 1;
justify-content: space-around;
/* flex-direction: row; */
text-align: center;
}

.header-menu li {
font-variant-caps: all-petite-caps;
font-size: medium;
line-height: 0.8;
margin-left: 0.5rem;
margin-right: 0.5rem;
}

.header-menu li:hover a:hover {
color: #f79518;
}

.header-hamburger {
display: flex;
flex: 1;
justify-content: end;
flex-direction: row;
text-align: center;
}

body {
font-family: "Poppins", sans-serif;
font-size: large;
}

@media (max-width: 1140px) {
.header-image {
margin-left: 5rem;
margin-right: 5rem;
}

.header-menu {
justify-content: space-between; /* Adjust spacing for smaller screens */
}
}

/* TODO: @kohrachel add hamburger menu support for widths less than 900px */
@media (max-width: 900px) {
.header-image {
margin-left: 2rem;
margin-right: 2rem;
}

.header-menu {
justify-content: space-between; /* Adjust spacing for smaller screens */
}
}
115 changes: 115 additions & 0 deletions frontend/src/components/headerBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import React, { Dispatch, SetStateAction, useEffect, useState } from "react";
import { Link } from "react-router-dom";
import { Menu, X } from "lucide-react";
import "./headerBar.css";

export const headerItems = [
{
description: "Home",
href: "#",
},
{
description: "About",
href: "#",
},
{
description: "Programs",
href: "#",
},
{
description: "Calendar",
href: "#",
},
{
description: "How to Help",
href: "#",
},
{
description: "News",
href: "#",
},
{
description: "Contact",
href: "#",
},
{
description: "Portal",
href: "#",
},
{
description: "🇺🇸 English",
href: "#",
},
];

interface HeaderBarProps {
isOpen: boolean;
setIsOpen: Dispatch<SetStateAction<boolean>>;
}

// The Header Bar
export function HeaderBar({ isOpen, setIsOpen }: HeaderBarProps) {
// State to handle collapsibility
const [isCollapsed, setIsCollapsed] = useState<boolean>(false);

// Automatically collapse header bar for narrow screens
useEffect(() => {
const handleResize = () => {
setIsCollapsed(window.innerWidth < 768);
};

window.addEventListener("resize", handleResize);
return () => {
window.removeEventListener("resize", handleResize);
};
}, []);

return (
<div className="header flex flex-row w-full mb-3">
<FosterSourceLogo />
{!isCollapsed ? (
<HeaderItems displayOptions="header-menu flex-row" />
) : (
<ul className="header-hamburger">
<a href="#" className="w-full">
<button
className="rounded p-3 flex gap-3 justify-end text-center w-full"
onClick={() => setIsOpen(!isOpen)}
>
{isOpen ? <X /> : <Menu />}
</button>
</a>
</ul>
)}
</div>
);
}

// Display the Fostersource logo
function FosterSourceLogo() {
return (
<img
src="/assets/fostersource-logo.png"
alt="FosterSource logo"
className="header-image"
/>
);
}

interface HeaderItemsProps {
displayOptions: string;
outline?: string;
}

// Display and handle header bar entries
export function HeaderItems({ displayOptions, outline }: HeaderItemsProps) {
const headerItemList = headerItems.map(({ description, href }) => (
<li className="border-black border-solid">
<Link to={href}>{description}</Link>
</li>
));

return <ul className={`${displayOptions}`}>{headerItemList}</ul>;
}

export default HeaderBar;
146 changes: 146 additions & 0 deletions frontend/src/components/sidebar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
.sidebar {
width: 20%;
min-width: 240px;
max-width: 300px;
max-height: min-content;
background-color: #ffffff;
margin-right: 0.75rem;
margin-left: 0.75rem;
height: 80vh;
box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
border-radius: 0.7rem;
overflow: auto;
transition: all 0.2s;
}

.profile {
vertical-align: middle;
font: medium;
max-width: 75%;
margin-top: 1.8rem;
margin-left: 1.8rem;
margin-right: 1.8rem;
margin-bottom: 20px;
align-items: center;
}

.profile-pic {
vertical-align: middle;
width: 70px;
height: 70px;
border-radius: 50%;
}

.login {
background-color: #f79518;
text-align: center;
border-radius: 0.5rem;
}

.menu {
font-weight: 500;
list-style-type: none;
}

.menu li {
vertical-align: middle;
display: flex;
flex-direction: row;
align-items: center;
padding-top: 0.7rem;
padding-bottom: 0.7rem;
padding-left: 1.8rem;
padding-right: 1.8rem;
position: relative;
}

.menu a {
text-decoration: none;
display: flex;
align-items: center;
}

.menu li:hover a {
color: #f79518;
}

.menu li:hover svg {
color: #f79618;
}

.menu li.active {
background-color: #f7951833;
color: #e28815;
}

.menu li.active a {
color: #e28815;
}

.menu li.active::after {
content: "";
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
width: 3px;
height: 65%;
background-color: #f79518;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}

.menu .logout li:hover a {
color: #be0000 !important;
}

.menu .logout li:hover svg {
color: #be0000 !important;
}

.menu .logout li.active {
background-color: #f7181833 !important;
color: #be0000 !important;
}

.menu .logout li.active a {
color: #be0000 !important;
}

.menu .logout li.active::after {
background-color: #be0000 !important;
}

body {
font-family: "Poppins", sans-serif;
font-size: large;
}

@media (max-width: 768px) {
.profile-pic {
width: 40px;
height: 40px;
}

.sidebar {
min-width: 70px;
width: 70px;
padding-left: 0;
}

.menu li {
padding-left: 1.5rem;
}

.profile {
padding-left: 0px;
padding-right: 0px;
margin-left: 0.95rem;
margin-right: 0px;
max-width: 60%;
}
.login {
padding-left: 0;
padding-right: 0;
}
}
Loading