Skip to content

Commit

Permalink
fix: logo moves upon navbar expansion and navbar is fixed to top of t…
Browse files Browse the repository at this point in the history
…he screen
  • Loading branch information
waalbert committed Sep 7, 2023
1 parent f2655d0 commit b2f5113
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 94 deletions.
20 changes: 4 additions & 16 deletions apps/site/src/assets/icons/zothacks-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 20 additions & 18 deletions apps/site/src/assets/images/lined_paper.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 19 additions & 9 deletions apps/site/src/components/NavBar/NavBar.module.scss
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
@use "@/lib/styles/variables.scss" as variables;

.nav {
position: fixed;
width: 100%;
}

.navbar {
background-image: url("~@/assets/images/lined_paper.svg");
background-size: cover;
background-position: left top;
background-position: left bottom;
background-repeat: no-repeat;
filter: drop-shadow(0px 2.5px 2px rgba(0, 0, 0, 0.4));
}

.logo {
position: absolute;
left: 0px;
top: 0px;
left: 30px;
width: 20vw;
height: 20vw;
text-align: center;
transform: rotate(-16.81deg) translateY(-5vw);
}

.homeNotActive,
Expand Down Expand Up @@ -58,13 +64,9 @@
}

@include variables.media-breakpoint-down(md) {
.nav {
background-size: auto 64px;
background-repeat: repeat;
}
.logo {
left: 1.8vw;
top: 1.8vw;
left: 3vw;
transform: rotate(-16.81deg) translateY(-6vw);
}
.homeNotActive,
.resourcesNotActive,
Expand All @@ -75,3 +77,11 @@
font-size: 1.5rem;
}
}

@include variables.media-breakpoint-up(lg) {
.logo {
width: 180px;
height: 180px;
transform: rotate(-16.81deg) translateY(-50px);
}
}
96 changes: 45 additions & 51 deletions apps/site/src/components/NavBar/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,56 +16,50 @@ export default function NavBar() {
const activeRoute = usePathname();

return (
<Navbar expand="md" className={`bg-body-tertiary ${styles.nav}`}>
<Container fluid>
<Navbar.Brand>
<Link href="/">
<div className={styles.logo}>
<Image
src={ZotHacksLogo.src}
alt="ZotHacks Logo"
// width="300"
// height="300"
fill
// className={"img-fluid"}
/>
</div>
</Link>
</Navbar.Brand>
<Navbar.Toggle aria-controls="basic-navbar-nav" />
<Navbar.Collapse id="basic-navbar-nav">
<Nav className="ms-auto text-center">
<Link
href="/"
className={
activeRoute === "/" ? styles.homeActive : styles.homeNotActive
}
>
Home
</Link>
<Link
href="/resources"
className={
activeRoute === "/resources"
? styles.resourcesActive
: styles.resourcesNotActive
}
>
Resources
</Link>
<Link
href="/schedule"
className={
activeRoute === "/schedule"
? styles.scheduleActive
: styles.scheduleNotActive
}
>
Schedule
</Link>
</Nav>
</Navbar.Collapse>
</Container>
</Navbar>
<nav className={styles.nav}>
<Navbar expand="md" className={`bg-body-tertiary ${styles.navbar}`}>
<Container fluid>
<Navbar.Brand />
<Navbar.Toggle aria-controls="basic-navbar-nav" />
<Navbar.Collapse id="basic-navbar-nav">
<Nav className="ms-auto text-center">
<Link
href="/"
className={
activeRoute === "/" ? styles.homeActive : styles.homeNotActive
}
>
Home
</Link>
<Link
href="/resources"
className={
activeRoute === "/resources"
? styles.resourcesActive
: styles.resourcesNotActive
}
>
Resources
</Link>
<Link
href="/schedule"
className={
activeRoute === "/schedule"
? styles.scheduleActive
: styles.scheduleNotActive
}
>
Schedule
</Link>
</Nav>
</Navbar.Collapse>
</Container>
</Navbar>
<Link href="/">
<div className={styles.logo}>
<Image src={ZotHacksLogo.src} alt="ZotHacks Logo" fill />
</div>
</Link>
</nav>
);
}

0 comments on commit b2f5113

Please sign in to comment.