Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
Add Responsive Menu to Navbar
Browse files Browse the repository at this point in the history
chore: add responsive menu
chore: replace all `class` attributes with `className`
Update coffee-bear.png
  • Loading branch information
wesdevpro committed Nov 15, 2023
1 parent 3bda538 commit 540e4ed
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 50 deletions.
Binary file modified src/EducationTrail/ClientApp/src/assets/images/coffee-bear.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/EducationTrail/ClientApp/src/components/NavFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ export class NavFooter extends Component {
<div>
<div className="grid grid-flow-col gap-4">
<a href="https://educationtrail.org/discord">
<span class="i-ic-baseline-discord auto text-2xl"></span>
<span className="i-ic-baseline-discord auto text-2xl"></span>
</a>
<a href="https://www.instagram.com/educationtrail/">
<span class="i-mdi-instagram auto text-2xl"></span>
<span className="i-mdi-instagram auto text-2xl"></span>
</a>
<a href="https://ntohqdevelopers.com/">
<span class="i-mdi-twitter auto text-2xl"></span>
<span className="i-mdi-twitter auto text-2xl"></span>
</a>
</div>
</div>
Expand Down
109 changes: 63 additions & 46 deletions src/EducationTrail/ClientApp/src/components/NavMenu.js
Original file line number Diff line number Diff line change
@@ -1,59 +1,76 @@
import React, { Component } from "react";
import EducationTrailEmblem from "../assets/images/education_trail_emblem.png";

export function hamburgerClicked() {
document.getElementById("mobile-menu").classList.toggle("hidden");
}

export class NavMenu extends Component {
static displayName = NavMenu.name;

render() {
return (
<nav class="navbar bg-base-100">
{/* navbar container right */}
<div class="navbar-start">
<div class="navbrand">
<a
className="btn btn-ghost normal-case text-xl"
href="/"
>
<div class="w-10 rounded-full">
<img
src={EducationTrailEmblem}
alt="The education trail's emblem."
className="mask mask-circle shadow-xl"
/>
</div>
<h3 class="hidden sm:block">The Education Trail</h3>
</a>
</div>
{/* navbar navigation */}
<div className="hidden w-full md:flex md:items-center md:w-auto">
<ul className="menu menu-horizontal px-1">
<li>
<a className="text-dark" href="/">
Home
</a>
</li>
<li>
<a className="text-dark" href="/counter">
Counter
</a>
</li>
</ul>
</div>
<nav className="navbar bg-base-100">
{/* navbar container right */}
<div className="navbar-start">
<div className="navbrand">
<a className="btn btn-ghost normal-case text-xl" href="/">
<div className="w-10 rounded-full">
<img
src={EducationTrailEmblem}
alt="The education trail's emblem."
className="mask mask-circle shadow-xl"
/>
</div>
<h3 className="hidden sm:block">The Education Trail</h3>
</a>
</div>
{/* navbar end */}
<div class="navbar-end">
{/* search? login? */}
<div>

</div>
{/* mobile navburger */}
<div class="cursor-pointer md:hidden block">
<button class="btn btn-ghost auto">
<span class="i-fa-solid-bars auto text-xl"></span>
</button>
</div>
{/* navbar navigation */}
<div className="hidden w-full md:flex md:items-center md:w-auto">
<ul className="menu menu-horizontal px-1">
<li>
<a className="text-dark" href="/">
Home
</a>
</li>
<li>
<a className="text-dark" href="/counter">
Counter
</a>
</li>
</ul>
</div>
</div>
{/* navbar end */}
<div className="navbar-end">
{/* search? login? */}
<div></div>
{/* mobile navburger */}
<div className="cursor-pointer md:hidden block">
<button className="btn btn-ghost auto" onClick={hamburgerClicked}>
<span className="i-fa-solid-bars auto text-xl"></span>
</button>
</div>
{/* mobile menu */}
<div
class="hidden md:hidden fixed top-0 right-0 bg-base-100 w-full h-full z-50"
id="mobile-menu"
>
<ul class="menu p-4">
<li>
<a class="text-dark" href="/">
Home
</a>
</li>
<li>
<a class="text-dark" href="/counter">
Counter
</a>
</li>
</ul>
</div>
</nav>
</div>
</nav>
);
}
}
2 changes: 1 addition & 1 deletion src/EducationTrail/ClientApp/src/layouts/HomeLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class HomeLayout extends Component {
return (
<div>
<NavMenu />
<div class="container">
<div className="container">
{this.props.children}
</div>
<NavFooter />
Expand Down

0 comments on commit 540e4ed

Please sign in to comment.