adjusted Header and Navbar to provided mockup

This commit is contained in:
s5260822 2025-03-20 00:33:20 +01:00
parent 4f3ee4ef51
commit e03e6e75c9
2 changed files with 243 additions and 13 deletions

View file

@ -2,11 +2,11 @@
:root {
--primary-color: #333;
--accent-color: #a00000;
--accent-color: #a8170d;
--background-color: #F4F4F9;
--confirm-button-color: #28a745;
--confirm-button-color-hover: #218838;
--header-background-color: darkgray;
--header-background-color: #171717;
}
@ -28,6 +28,13 @@ header {
left: 0;
right: 0;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
border-bottom: 5px solid #a8170d;
}
header h1 {
color: white;
text-align: center;
padding: 10px;
}
nav {
@ -233,4 +240,124 @@ tbody tr:hover {
select {
min-width: 200px;
}
}
.hamburger-menu {
position: relative;
width: 30px;
height: 21.5px;
cursor: pointer;
margin: 16px;
}
.hamburger-line {
position: absolute;
width: 100%;
height: 4px;
background-color: white;
border-radius: 4px;
transition: transform 0.3s, opacity 0.3s;
}
.hamburger-line:nth-child(2) {
top: 50%;
transform: translateY(-50%);
}
.hamburger-line:nth-child(3) {
bottom: 0;
}
.hamburger-menu.open .line-1 {
transform: rotate(-45deg) translate(-6px, 6px);
}
.hamburger-menu.open .line-2 {
opacity: 0;
}
.hamburger-menu.open .line-3 {
transform: rotate(45deg) translate(-6px, -6px);
}
.navigation-menu {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: var(--nav-menu-background-color);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
z-index: 9999;
opacity: 0;
pointer-events: none;
transition: opacity 0.3s;
}
.navigation-menu.show {
opacity: 1;
pointer-events: auto;
}
.close-button {
position: absolute;
top: 1px;
left: 1px;
font-size: 24px;
color: var(--header-font-color);
cursor: pointer;
}
.links {
list-style: none;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
}
.links li {
margin: 10px 0;
}
.links a {
color: var(--header-font-color);
text-decoration: none;
font-size: 18px;
}
.navbar {
background-color: var(--header-background-color);
padding: 10px;
padding-top: 0;
padding-bottom: 0;
text-align: center;
width: 100%;
height: 58px;
display: flex;
position: fixed;
top: 0;
z-index: 1;
}
@media only screen and (max-width: 650px) and (min-width: 375px) {
.nav-links {
display: none;
}
.hamburger-menu {
display: block;
}
}
@media only screen and (max-width: 375px) and (min-width: 0px) {
.nav-links {
display: none;
}
.hamburger-menu {
display: block;
}
}

View file

@ -1,12 +1,115 @@
<header>
<div class="hamburger-menu">
<div class="hamburger-line line-1"></div>
<div class="hamburger-line line-2"></div>
<div class="hamburger-line line-3"></div>
</div>
<h1 style="margin-bottom: 0">Multimodal Parliament Explorer</h1>
<nav>
<p></p>
<a href="/">Home</a>
<a href="/members">Parlamentarier</a>
<a href="/reden">Reden</a>
<a href="/export">Exportieren</a>
<a href="/about">Über</a>
<p></p>
</nav>
</header>
<nav class="nav-links">
<a href="/">Home</a>
<br>
<a href="/members">Parlamentarier</a>
<br>
<a href="/reden">Reden</a>
<br>
<a href="/export">Exportieren</a>
<br>
<a href="/about">Über</a>
</nav>
</header>
<script>
const hamburgerMenu = document.querySelector('.hamburger-menu');
const navLinks = document.querySelector('.nav-links');
hamburgerMenu.addEventListener('click', () => {
// Toggle the 'open' class on the hamburger menu
hamburgerMenu.classList.toggle('open');
if (hamburgerMenu.classList.contains('open')) {
navLinks.style.display = 'block'; // Show the nav-links
navLinks.classList.add('slide-in'); // Trigger the slide-in animation
} else {
navLinks.style.display = 'none'; // Hide the nav-links
navLinks.classList.remove('slide-in'); // Reset the animation
}
});
</script>
<style>
.hamburger-menu {
position: absolute;
top: 10px;
left: 10px;
width: 30px;
height: 21.5px;
cursor: pointer;
margin: 16px;
z-index: 20;
}
.hamburger-line {
position: absolute;
width: 100%;
height: 4px;
background-color: white;
border-radius: 4px;
transition: transform 0.3s, opacity 0.3s;
}
.hamburger-line:nth-child(2) {
top: 50%;
transform: translateY(-50%);
}
.hamburger-line:nth-child(3) {
bottom: 0;
}
.hamburger-menu.open .line-1 {
transform: rotate(-45deg) translate(-6px, 6px);
}
.hamburger-menu.open .line-2 {
opacity: 0;
}
.hamburger-menu.open .line-3 {
transform: rotate(45deg) translate(-6px, -6px);
}
.nav-links {
position: absolute;
top: 0;
left: -300px; /* Start from off-screen */
height: 100vh;
width: 300px;
background-color: var(--header-background-color);
display: none;
padding-top: 70px;
margin-bottom: 5px;
box-shadow: 3px 0px 15px rgba(0, 0, 0, 0.2);
transition: left 1s ease-in-out;
}
.nav-links.slide-in {
left: 0;
}
.nav-links a {
display: block;
padding: 10px;
text-decoration: none;
font-weight: bold;
color: white;
border: none;
margin: 0;
padding: 0;
padding-left: 10px;
}
.nav-links a:hover {
background-color: var(--header-background-color);
color: var(--accent-color);
}
</style>