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

Fix/navbar #55

Merged
merged 2 commits into from
Jun 6, 2024
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
1 change: 1 addition & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"react": "^18.2.0",
"react-cookies": "^0.1.1",
"react-dom": "^18.2.0",
"react-icons": "^5.2.1",
"react-router": "^6.22.0",
"react-router-dom": "^6.22.0",
"tailwind-merge": "^2.2.1",
Expand Down
116 changes: 87 additions & 29 deletions web/src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,92 @@
import peacockLogo from '../assets/peacock-logo.png';
import whiteName from '../assets/auis_white.png';
import { useState } from "react";
import { Link, useLocation } from "react-router-dom";
import { IoMdClose, IoMdMenu } from "react-icons/io";
import peacockLogo from "../assets/peacock-logo.png";
import whiteName from "../assets/auis_white.png";

function Header() {
return (
<header className="bg-[#034159] h-[90px] w-full px-[15px] flex justify-between items-center">
{/* Images and logo */}
<a className="flex items-center" href="/">
<img className="object-contain w-[70px] h-[70px]" src = {peacockLogo}/>
<img className="object-contain w-[172px] h-[62px]" src = {whiteName}/>
</a>
{/* Links */}
<nav>
<ul className="text-white flex items-center gap-8 text-lg">
<li><a className="hover:bg-[#05394d] px-3 py-2 rounded" href="#">Events</a></li>
<li><a className="hover:bg-[#05394d] px-3 py-2 rounded" href="/pvv">About Us</a></li>
<li><a className="hover:bg-[#05394d] px-3 py-2 rounded" href="/exec">Leadership Team</a></li>
<li><a className="hover:bg-[#05394d] px-3 py-2 rounded" href="/credits">Credits</a></li>
</ul>
</nav>
{/* Login signup buttons */}
<div className="flex items-center gap-8 px-[10px]">
<a href="/login">
<button className="bg-[#FC8700] hover:bg-[#fc7300] text-black px-[18px] py-[10px] text-base rounded" style={{borderRadius: '10px' }}>Log-in</button>
</a>
<a href="/signup">
<button className="bg-[#FC8700] hover:bg-[#fc7300] text-black px-[18px] py-[10px] text-base rounded" style={{borderRadius: '10px' }}>Sign-up</button>
</a>
</div>
</header>
);
const [navBar, setNavBar] = useState(false);
const { pathname } = useLocation();

const titles = [
{ title: "Events", page: "/" },
{ title: "About Us", page: "/pvv" },
{ title: "Leadership Team", page: "/exec" },
{ title: "Credits", page: "/credits" },
];

return (
<header className="w-full bg-[#034159] fixed top-0 z-50 shadow h-[90px] px-[15px] flex items-center justify-between">
<div className="flex items-center justify-between w-full lg:w-auto">
<a className="flex items-center" href="/">
<img
className="object-contain w-[70px] h-[70px]"
src={peacockLogo}
alt="Peacock Logo"
/>
<img
className="object-contain w-[172px] h-[62px] ml-2"
src={whiteName}
alt="Logo Text"
/>
</a>
<div className="lg:hidden">
<button onClick={() => setNavBar(!navBar)}>
{navBar ? (
<IoMdClose className="text-white" size={40} />
) : (
<IoMdMenu className="text-white" size={40} />
)}
</button>
</div>
</div>
<nav
className={`fixed top-0 right-0 h-full bg-[#034159] p-8 z-40 transform transition-transform ${
navBar ? "translate-x-0" : "translate-x-full"
} lg:static lg:transform-none lg:p-0 lg:bg-transparent lg:flex lg:items-center lg:w-auto`}
>
<button
className="absolute top-4 right-4 lg:hidden"
onClick={() => setNavBar(false)}
>
<IoMdClose className="text-white" size={40} />
</button>
<div className="flex flex-col lg:flex-row items-center gap-8 lg:gap-5 lg:mt-0 mt-10 text-xl text-white">
{titles.map((label, index) => (
<li key={index} className="list-none">
<Link
to={label.page}
className={`${
pathname === label.page ? "font-bold" : ""
} hover:bg-[#05394d] px-3 py-2 rounded block lg:inline-block`}
onClick={() => setNavBar(false)}
>
{label.title}
</Link>
</li>
))}
<div className="flex flex-col lg:flex-row items-center gap-8 mt-4 lg:mt-0 lg:ml-8">
<a href="/login">
<button
className="bg-[#FC8700] hover:bg-[#fc7300] text-black px-[18px] py-[10px] text-xl"
style={{ borderRadius: "10px" }}
>
Log-in
</button>
</a>
<a href="/signup">
<button
className="bg-[#FC8700] hover:bg-[#fc7300] text-black px-[18px] py-[10px] text-xl"
style={{ borderRadius: "10px" }}
>
Sign-up
</button>
</a>
</div>
</div>
</nav>
</header>
);
}

export default Header;
7 changes: 4 additions & 3 deletions web/src/screens/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { useParams } from "react-router";
import urls from "@utils/urls";
import auisLogo from "../assets/peacock.png";
import auisAbbrev from "../assets/AUIS_black 3.png";
import LoadingSpinner from "@components/LoadingSpinner";
//import LoadingSpinner from "@components/LoadingSpinner";

export default function HomeScreen() {
const { name } = useParams();

const { data, isLoading, isError, error } = useQuery({
const { data, isError, error } = useQuery({
queryKey: [QueryKeys.GetIntro, name],
queryFn: async () => {
const { data } = await axios(`/hello/${name}`, {
Expand All @@ -21,9 +21,10 @@ export default function HomeScreen() {
},
});

/**
if (isLoading) {
return <LoadingSpinner />;
}
} */
if (isError) {
return <div>Error: {error.name}</div>;
}
Expand Down
29 changes: 20 additions & 9 deletions web/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,39 @@
import daisyui from 'daisyui';
import themes from 'daisyui/src/theming/themes';
import daisyui from "daisyui";
import themes from "daisyui/src/theming/themes";

/** @type {import('tailwindcss').Config} */
export default {
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
plugins: [daisyui],
theme: {
extend: {
fontFamily: {
sans: ['Montserrat'],
body: ['Open Sans'],
sans: ["Montserrat"],
body: ["Open Sans"],
},
},
container: {
center: true,
padding: "2rem",
screens: {
"2xl": "1400px",
sm: "480px",
md: "768px",
lg: "976px",
xl: "1440px",
},
},
},
daisyui: {
themes: [
{
light: {
...themes['light'],
accent: '#087df1',
...themes["light"],
accent: "#087df1",
},
dark: {
...themes['dark'],
accent: '#087df1',
...themes["dark"],
accent: "#087df1",
},
},
],
Expand Down
5 changes: 5 additions & 0 deletions web/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2471,6 +2471,11 @@ react-dom@^18.2.0:
loose-envify "^1.1.0"
scheduler "^0.23.0"

react-icons@^5.2.1:
version "5.2.1"
resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-5.2.1.tgz#28c2040917b2a2eda639b0f797bff1888e018e4a"
integrity sha512-zdbW5GstTzXaVKvGSyTaBalt7HSfuK5ovrzlpyiWHAFXndXTdd/1hdDHI4xBM1Mn7YriT6aqESucFl9kEXzrdw==

react-is@^17.0.1:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
Expand Down
Loading