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

navbar add #30

Merged
merged 5 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/app/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function RootLayout({ children }) {
<html lang="en">
<body className={urbanist.className}>
<Navigation />
<div className="w-full flex flex-col items-center justify-center">
<div className="w-full flex flex-col items-center justify-center mt-16 md:mt-[8vh]">
{children}
</div>
<Footer />
Expand Down
85 changes: 84 additions & 1 deletion src/components/Navigation.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,88 @@
"use client";
import Navbar from "react-bootstrap/Navbar";
import blueLogo from "../../public/assets/blueLogo.svg";
import Link from "next/link";
import Image from "next/image";
import { navigation } from "../data/navigation";
import Nav from "react-bootstrap/Nav";
import { useState } from "react";
import { NavDropdown } from "react-bootstrap";
import { FaBars } from "react-icons/fa";

const Navigation = () => {
return <div>Navigation</div>;
const [selected, setSelected] = useState("");

return (
<Navbar
collapseOnSelect
expand="md"
fixed="top"
className="w-full h-16 md:h-[8vh] flex pb-10 font-playfair !bg-white justify-between items-center"
>
<Navbar.Brand className="p-0 h-full">
<Link
onClick={() => setSelected("")}
href="/"
className="items-center flex ml-3 h-full"
>
<Image src={blueLogo} className="h-full" />
</Link>
</Navbar.Brand>
<Navbar.Toggle
className="list-unstyled !text-transparent border-0"
aria-controls="basic-navbar-nav"
>
<FaBars className="text-ewb-blue-200 text-xl" />
</Navbar.Toggle>
<Navbar.Collapse className="items-center md:justify-end justify-center">
<Nav className="mb-2 no-underline text-lg flex items-center gap-2 mr-4">
{navigation.map((item, index) => (
<div key={index}>
{item.sub.length > 0 ? (
<NavDropdown
onClick={() => setSelected(item.name)}
className="[&>*]:!border-0 [&>*]:!p-0 [&>*]:!m-0 [&>*]:!bg-transparent"
title={
<span
className={`hover:cursor-pointer rounded-full mb-0 py-1 px-4 no-underline !text-black text-lg whitespace-nowrap !font-normal hover:!text-blue-600 duration-300 ${
selected === item.name &&
"!bg-ewb-blue-200 rounded-full text-white hover:!text-white"
}`}
>
{item.name}
</span>
}
>
{item.sub.map((country, index) => (
<NavDropdown.Item
key={index}
className="text-white hover:!bg-ewb-green !bg-ewb-blue-200 first:!mt-5"
href={"/projects" + country.link}
>
{country.name}
</NavDropdown.Item>
))}
</NavDropdown>
) : (
<Nav.Link
as={Link}
key={index}
href={item.link}
onClick={() => setSelected(item.name)}
className={`hover:cursor-pointer rounded-full mb-0 py-0 px-4 no-underline !text-black text-lg whitespace-nowrap !font-normal hover:!text-blue-600 duration-300 ${
selected === item.name &&
"!bg-ewb-blue-200 rounded-full text-white hover:!text-white"
}`}
>
{item.name}
</Nav.Link>
)}
</div>
))}
</Nav>
</Navbar.Collapse>
</Navbar>
);
};

export default Navigation;
18 changes: 9 additions & 9 deletions src/data/navigation.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
export const navigation = [
{
name: "ABOUT",
link: "about",
link: "/about",
sub: [],
},
{
name: "PROJECTS",
link: "projects",
link: "/projects",
sub: [
{ name: "Costa Rica", link: "costa-rica" },
{ name: "Tanzania", link: "tanzania" },
{ name: "Costa Rica", link: "/costa-rica" },
{ name: "Tanzania", link: "/tanzania" },
{
name: "Water Quality and Filtration",
link: "water-quality-and-filtration",
link: "/water-quality-and-filtration",
},
{ name: "Robotics", link: "robotics" },
{ name: "Air Quality System", link: "air-quality-system" },
{ name: "Robotics", link: "/robotics" },
{ name: "Air Quality System", link: "/air-quality-system" },
],
},
{
name: "EVENTS",
link: "events",
link: "/events",
sub: [],
},
{
name: "BOARD",
link: "board",
link: "/board",
sub: [],
},
];