Skip to content

Commit

Permalink
Navbar improvements (#50)
Browse files Browse the repository at this point in the history
* Improve navbar layout to better fit mobile screens

* Lint
  • Loading branch information
pedroCX486 authored Jan 30, 2024
1 parent 6a406fd commit d8f57ee
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";

export const Footer = () => {
return (
<footer className="footer items-center bg-neutral p-4 text-neutral-content mt-10">
<footer className="footer mt-10 items-center bg-neutral p-4 text-neutral-content">
<aside className="grid-flow-row items-center">
<p>Mayhem Hub - {new Date().getFullYear()}</p>
<small>Version: {process.env.BUILD_ID}</small>
Expand Down
84 changes: 84 additions & 0 deletions src/components/NavBar/NavBar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
.nav {
height: 63px;
width: 100%;
position: relative;
z-index: 2;
}

.nav > .nav-header {
display: inline;
}

.nav > .nav-header > .nav-title {
display: inline-block;
}

.nav > .nav-btn {
display: none;
}

.nav > .nav-links {
display: inline;
float: right;
font-size: 18px;
}

.nav > .nav-links > a {
display: inline-block;
text-decoration: none;
}

.nav > .nav-links > a:hover {
background-color: rgba(0, 0, 0, 0.3);
}

.nav > #nav-check {
display: none;
}

@media (max-width: 600px) {
.nav > .nav-btn {
display: inline-block;
position: absolute;
right: 0px;
top: 0px;
}
.nav > .nav-btn > label {
display: inline-block;
width: 65px;
height: 63px;
padding: 21px;
margin-right: 1rem;
}
.nav > .nav-btn > label:hover,
.nav #nav-check:checked ~ .nav-btn > label {
background-color: rgba(0, 0, 0, 0.3);
}
.nav > .nav-btn > label > span {
display: block;
width: 25px;
height: 10px;
border-top: 2px solid #eee;
}
.nav > .nav-links {
position: absolute;
display: block;
width: 100%;
height: 0px;
transition: all 0.3s ease-in;
overflow-y: hidden;
top: 63px;
left: 0px;
}
.nav > .nav-links > a {
display: block;
width: 100%;
}
.nav > #nav-check:not(:checked) ~ .nav-links {
height: 0px;
}
.nav > #nav-check:checked ~ .nav-links {
height: calc(50vh - 63px);
overflow-y: auto;
}
}
55 changes: 29 additions & 26 deletions src/components/NavBar/NavBar.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
import "./NavBar.css";

export const NavBar = () => {
return (
<div className="navbar bg-gray-700">
<div className="flex-1">
<a className="btn btn-ghost text-xl">Mayhem Hub</a>
<div className="nav bg-neutral">
<input type="checkbox" id="nav-check" />
<div className="nav-header">
<div className="nav-title p-3 text-3xl text-neutral-content">
Mayhem Hub
</div>
</div>
<div className="hidden flex-none sm:block">
<ul className="menu menu-horizontal px-1">
<li>
<a href="https://discord.hackrf.app" target="_blank">
Discord
</a>
</li>
<li>
<a href="https://repo.hackrf.app" target="_blank">
Repo
</a>
</li>
<li>
<a href="https://wiki.hackrf.app" target="_blank">
Wiki
</a>
</li>
<li>
<a href="https://release.hackrf.app" target="_blank">
Firmware Releases
</a>
</li>
</ul>
<div className="nav-btn">
<label htmlFor="nav-check">
<span></span>
<span></span>
<span></span>
</label>
</div>

<div className="nav-links bg-neutral text-neutral-content">
<a href="https://discord.hackrf.app" target="_blank" className="p-4">
Discord
</a>
<a href="https://repo.hackrf.app" target="_blank" className="p-4">
Repo
</a>
<a href="https://wiki.hackrf.app" target="_blank" className="p-4">
Wiki
</a>
<a href="https://release.hackrf.app" target="_blank" className="p-4">
Firmware Releases
</a>
</div>
</div>
);
Expand Down

0 comments on commit d8f57ee

Please sign in to comment.