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

Mobile Fixes for Proj Website #11

Merged
merged 2 commits into from
Sep 25, 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
53 changes: 51 additions & 2 deletions src/components/navbar/Navbar.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@
padding: 16px 30px 16px 30px;
margin-left: 32px;
display: flex;
flex-flow: row nowrap;

.navLinks {
display: flex;
flex-flow: row nowrap;
justify-content: flex-start;

&.hidden {
display: none;
}
}

a {
display: flex;
Expand Down Expand Up @@ -62,7 +73,6 @@
margin-bottom: 2px;
}
}

}

// navbar right side contains all navlinks on desktop
Expand Down Expand Up @@ -109,13 +119,23 @@

// toggle button for mobile menu is only visible on mobile, otherwise hidden
.toggleIcon {
position: relative;
// position: relative;
// width: 40px;
// height: 20px;
// margin: 0 30px;
// padding: 0;
// background-color: vars.$white;
position: absolute;
top: 30px;
right: 0;
width: 40px;
height: 20px;
margin: 0 30px;
padding: 0;
border: none;
background-color: vars.$white;


// the toggle icon is composed of two bars we can separately animate between a hamburger icon and an x icon (default is hamburger, we have .open class we can toggle to rotate into the shape of an x)
.bar1 {
width: 40px;
Expand Down Expand Up @@ -154,6 +174,35 @@
}
}


.mobileNav {
width: 100vw;
background-color: vars.$white;
position: relative;
z-index: -1;
display: flex;
flex-flow: column nowrap;
justify-content: center;
align-items: center;
line-height: 300%;
transition: 0.3s ease-in-out;
// mobile menu is hidden by positioning under fixed navbar, we open it by sliding it out
margin-top: -22rem;
&.open {
margin-top: 0;
}
.navItem {
width: 100%;
text-align: center;
color: vars.$black;
transition: 0.3s ease-in-out all;
text-decoration: underline solid transparent;
&:hover {
text-decoration: underline solid currentColor;
}
}
}


// rainbow bar is always visible below navbar, positioned to be at the bottom of the container even when mobile slides out and height changes
.rainbow {
Expand Down
68 changes: 47 additions & 21 deletions src/components/navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,71 @@
import Link from "next/link";
import { useEffect, useState } from "react";
import ProjLogo from "../../../public/assets/proj_logo.png";
import s from "../navbar/Navbar.module.scss";
import s from "./Navbar.module.scss";
import { Size, useWindowSize } from "../../utils/general";


const navLinks = [
{ href: "/#home", label: "Home" },
{ href: "/#apply", label: "Apply" },
{ href: "/#about", label: "About" },
{ href: "/#archive", label: "Archive" },
{ href: "/#gallery", label: "Gallery" },
];

const NavigationBar: React.FC = () => {
const size: Size = useWindowSize();

const [menuOpen, setMenuOpen] = useState(false);
const [mobile, setMobile] = useState(false);
const toggleMenu = () => setMenuOpen(!menuOpen);

useEffect(() => {
size && size.width && setMobile(size.width <= 960);
}, [size]);

useEffect(() => {
if (!mobile) setMenuOpen(false);
}, [mobile]);

return (
<div className={s.navbarWrapper}>
<div className={s.navbar}>
{/* Navbar ACM Logo */}
<div className={s.left}>
<Link href="#">
<div className={`${s.left}`}>
<Link href={"/"}>
<img src={ProjLogo.src} alt="ACM Logo" />
<p>Projects</p>
<p>ACM Projects</p>
</Link>
<div className={s.divider}>
<span>|</span>
</div>
<Link href={"/#home"}>
<p>Home</p>
</Link>

<Link href={"/#apply"}>
<p>Apply</p>
</Link>
<div className={`${s.navLinks} ${mobile && s.hidden}`}>
{navLinks.map((link, key) => (
<Link key={key} href={link.href}>
<p>{link.label}</p>
</Link>
))}
</div>
</div>

<Link href={"/#about"}>
<p>About</p>
</Link>
{/* Mobile Navbar Toggle */}
<button className={`${s.toggleIcon} ${!mobile && s.hidden}`} onClick={toggleMenu}>
<div className={`${s.bar1} ${menuOpen && s.open}`} />
<div className={`${s.bar2} ${menuOpen && s.open}`} />
</button>
</div>

<Link href={"/#archive"}>
<p>Archive</p>
</Link>
<Link href={"/#gallery"}>
<p>Gallery</p>
{/* Mobile Menu Dropdown */}
<div className={`${s.mobileNav} ${menuOpen && s.open}`}>
{navLinks.map((link, key) => (
<Link key={key} href={link.href}>
<p className={`${s.navItem}`} onClick={() => setMenuOpen(false)}>
{link.label}
</p>
</Link>
))}
</div>
</div>

{/* Bottom Rainbow */}
<div className={s.rainbow} />
</div>
Expand Down
20 changes: 16 additions & 4 deletions src/sections/Timer/style.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@
font-family: 'DM Sans';
font-size: 22px;
word-wrap: normal;


&__timer {
padding: 0 !important;
margin-top: 85px;
background-color: v.$blue;
justify-content: center;
align-items: center;
text-align: center;
display:flex;
height: 400px;
background-color: v.$blue !important;

&__header {
width: 100% !important;
Expand All @@ -28,6 +27,10 @@
h1 {
font-size: 52px;
font-weight: 700;

@media only screen and (max-width: 620px) {
font-size: 40px;
}
}
@media screen and (max-width: 768px) {
h1 {
Expand All @@ -39,6 +42,10 @@
p {
font-size: 41px;
font-weight: 300;

@media only screen and (max-width: 620px) {
font-size: 32px;
}
}
@media screen and (max-width: 768px) {
p {
Expand Down Expand Up @@ -112,13 +119,12 @@
}

@media only screen and (max-width: 500px) {
margin: 40px 0;
margin: 80px 0;

.home__communities__grid {
padding: 0;
}
}

}
}

Expand Down Expand Up @@ -155,4 +161,10 @@
margin: 0px auto;
}
}

@media only screen and (max-width: 800px) {
flex-direction: column;
align-items: center;
justify-items: flex-start
}
}
Loading