diff --git a/next/app/layout.tsx b/next/app/layout.tsx index 46127e7..c160a58 100644 --- a/next/app/layout.tsx +++ b/next/app/layout.tsx @@ -3,6 +3,7 @@ import Header from "@/components/header/header"; import Modal from "@/components/modal/Modal"; import ModalContextProvider from "@/components/modal/ModalContextProvider"; import "./globals.css"; +import SmallNavbarFetcher from "@/components/header/SmallNavbarFetcher"; export const metadata = { title: "Create Next App", @@ -23,8 +24,11 @@ export default async function RootLayout({
{/* @ts-ignore */} -
-
{children}
+
+
+
+ +
{children}
diff --git a/next/components/blocks/ImageWithText.module.css b/next/components/blocks/ImageWithText.module.css index 5314b70..3eef7b7 100644 --- a/next/components/blocks/ImageWithText.module.css +++ b/next/components/blocks/ImageWithText.module.css @@ -26,6 +26,14 @@ object-fit: cover; max-height: 80vh; width: 100%; + border-right: solid white 2px; + +} + +@media (max-width: 760px) { + .backgroundImg { + border-bottom: solid white 2px; + } } .Underline { diff --git a/next/components/blocks/ImageWithText.tsx b/next/components/blocks/ImageWithText.tsx index a37fe87..647b7a9 100644 --- a/next/components/blocks/ImageWithText.tsx +++ b/next/components/blocks/ImageWithText.tsx @@ -17,7 +17,7 @@ export default function ImageWithText({ props }: ImageWithTextProps) { return ( // // grid grid-cols-2 max-h-[80vh] -
+
{/*
*/} { + setMenuOpen(!menuOpen); + setProjectsOpen(false); + setMembersOpen(false); + }; + + const toggleProjects = () => { + setProjectsOpen(!projectsOpen); + }; + + const toggleMembers = () => { + setMembersOpen(!membersOpen); + }; + + return ( +
+
+
+ + Younite Logo + +
+
+ +
+
+ + {menuOpen && ( + +
+
+ + {membersOpen && ( +
+ {data.members.map( + ({ CommitteeYear }: { CommitteeYear: number }) => ( + + {CommitteeYear} + + ), + )} +
+ )} +
+ +
+ + {projectsOpen && ( +
+ + ACTIVE + + + PAST + +
+ )} +
+ + {links.map((link) => ( + + {link.title.toLocaleUpperCase()} + + ))} +
+
+ )} +
+ ); +} diff --git a/next/components/header/SmallNavbarFetcher.tsx b/next/components/header/SmallNavbarFetcher.tsx new file mode 100644 index 0000000..7d24c0d --- /dev/null +++ b/next/components/header/SmallNavbarFetcher.tsx @@ -0,0 +1,7 @@ +import SmallNavbar from "../header/SmallNavbar"; +import { getHeaderData } from "../header/headerDataFetcher"; + +export default async function SmallNavbarFetcher() { + const headerData = await getHeaderData(); + return ; +} diff --git a/next/components/header/header.module.css b/next/components/header/header.module.css index 003fe21..b870fb0 100644 --- a/next/components/header/header.module.css +++ b/next/components/header/header.module.css @@ -8,7 +8,7 @@ position: absolute; z-index: 30; isolation: isolate; - height: 8.5rem; + height: 8.5rem; /* Hides the header */ } .nav { @@ -31,4 +31,3 @@ position: relative; } } - diff --git a/next/components/header/header.tsx b/next/components/header/header.tsx index b6c14d9..20c7694 100644 --- a/next/components/header/header.tsx +++ b/next/components/header/header.tsx @@ -1,41 +1,8 @@ -import { headerSchema } from "@/schemas/single/Header"; import { getLargestImageUrl } from "@/util/image"; -import fetchStrapi from "@/util/strapi"; import Image from "next/image"; import Link from "next/link"; -import { z } from "zod"; import styles from "./header.module.css"; - -async function getHeaderData() { - const resData = await fetchStrapi("header", headerSchema); - const membersData = await fetchStrapi("member-teams", z.any()); - - // Ensure membersData is an array and sort in descending order - const members = Array.isArray(membersData) - ? membersData - .map((item: any) => ({ - ...item, - CommitteeYear: Number(item.CommitteeYear), // Convert to number for sorting - })) - .sort((a, b) => b.CommitteeYear - a.CommitteeYear) // Sort in descending order - : []; // Default to an empty array if not an array - - const projects = [ - { - Title: new Date().getFullYear(), - slug: "current", - }, - { - Title: "Past", - slug: "past", - }, - ]; - return { - ...resData, - members, - projects, - }; -} +import { getHeaderData } from "./headerDataFetcher"; export default async function Header() { const data = await getHeaderData(); diff --git a/next/components/header/headerDataFetcher.tsx b/next/components/header/headerDataFetcher.tsx new file mode 100644 index 0000000..4124fd4 --- /dev/null +++ b/next/components/header/headerDataFetcher.tsx @@ -0,0 +1,25 @@ +import fetchStrapi from "@/util/strapi"; +import { headerSchema } from "@/schemas/single/Header"; +import { z } from "zod"; + +export async function getHeaderData() { + const resData = await fetchStrapi("header", headerSchema); + const membersData = await fetchStrapi("member-teams", z.any()); + const members = Array.isArray(membersData) + ? membersData.map((item) => ({ + ...item, + CommitteeYear: Number(item.CommitteeYear), + })).sort((a, b) => b.CommitteeYear - a.CommitteeYear) + : []; + + const projects = [ + { Title: new Date().getFullYear().toString(), slug: "current" }, + { Title: "Past", slug: "past" }, + ]; + + return { + ...resData, + members, + projects, + }; +} \ No newline at end of file diff --git a/next/components/header/headerTypes.tsx b/next/components/header/headerTypes.tsx new file mode 100644 index 0000000..6b8fbe6 --- /dev/null +++ b/next/components/header/headerTypes.tsx @@ -0,0 +1,20 @@ +export type Navigation = { + title: string; + slug: string; +}; + +export type Member = { + CommitteeYear: number; +}; + +export type Project = { + Title: string; + slug: string; +}; + +export type HeaderData = { + navigation: Navigation[]; + Logo?: any; + members: Member[]; + projects?: Project[]; +}; diff --git a/next/components/svg/Cross.tsx b/next/components/svg/Cross.tsx new file mode 100644 index 0000000..0a7ebe3 --- /dev/null +++ b/next/components/svg/Cross.tsx @@ -0,0 +1,18 @@ +export default function Cross() { + return ( + + + + ); +} diff --git a/next/components/svg/Hamburger.tsx b/next/components/svg/Hamburger.tsx new file mode 100644 index 0000000..124d77a --- /dev/null +++ b/next/components/svg/Hamburger.tsx @@ -0,0 +1,18 @@ +export default function Hamburger() { + return ( + + + + ); +} diff --git a/next/components/svg/UpArrow.tsx b/next/components/svg/UpArrow.tsx new file mode 100644 index 0000000..db2114c --- /dev/null +++ b/next/components/svg/UpArrow.tsx @@ -0,0 +1,18 @@ +export default function UpArrow({ className = "" }: { className?: String }) { + return ( + + + + ); +}