firq-dev-website/src/components/navbar.astro

138 lines
2.6 KiB
Text
Raw Normal View History

2023-03-04 13:48:57 +01:00
---
import { Image } from 'astro:assets';
import logo from '../assets/logo.svg'
2023-12-29 22:57:30 +01:00
import hamburger from 'iconoir/icons/menu.svg'
const hamburger_src_url = `url("${hamburger.src}")`;
2023-03-04 13:48:57 +01:00
---
<header>
2024-06-20 19:52:34 +02:00
<a href="/" rel="noopener noreferrer" aria-label="Home" role="link">
<Image src={logo} alt=""/>
<span class="visually-hidden">Firq Logo</span>
2023-03-09 11:44:18 +01:00
</a>
<ul class="desktop">
<slot name="desktop"/>
2023-03-09 11:44:18 +01:00
</ul>
2024-06-20 19:52:34 +02:00
<button class="mobile" aria-label="Navigation Button" tabindex="0" onclick="this.focus()" role="button">
2023-03-09 11:44:18 +01:00
<ul>
<slot name="mobile"/>
2023-03-04 13:48:57 +01:00
</ul>
2023-03-09 11:44:18 +01:00
<div class="placeholder"></div>
2024-01-01 20:54:14 +01:00
<div class="hamburger-menu" role="navigation"></div>
2023-03-09 11:44:18 +01:00
</button>
2023-03-04 13:48:57 +01:00
</header>
2023-12-29 22:57:30 +01:00
<style define:vars={{ hamburger_src_url }}>
2023-03-09 11:44:18 +01:00
header {
z-index: 1000;
position: sticky;
top: 0px;
2023-03-09 11:44:18 +01:00
background-color: var(--c-darkgray);
display: flex;
height: auto;
width: 100%;
align-items: flex-start;
line-height: 1.5em;
}
header > a {
2023-12-31 16:50:29 +01:00
margin-left: 16px;
2023-03-09 11:44:18 +01:00
padding-top: 8px;
display: block;
height: 48px;
width: 48px;
}
a > img {
height: 100%;
width: 100%;
object-fit: contain;
}
.desktop {
align-items: center;
justify-content: space-around;
display: none;
flex-wrap: wrap;
flex-direction: row;
height: 64px;
width: 100%;
list-style-type: none;
row-gap: 0.5em;
column-gap: 0.5ch;
margin: 0px;
line-height: 1.5em;
}
.mobile > ul {
background-color: var(--c-darkgray);
align-items: center;
flex-wrap: wrap;
flex-direction: column;
display: flex;
width: 100%;
list-style-type: none;
line-height: 3em;
}
2023-03-04 20:11:51 +01:00
2023-03-09 11:44:18 +01:00
.placeholder {
display: flex;
width: 100%;
}
2023-03-04 20:11:51 +01:00
2023-03-09 11:44:18 +01:00
.mobile {
display: flex;
background-color: var(--c-darkgray);
border: 0px;
width: 100%;
height: 64px;
}
2023-03-04 20:11:51 +01:00
2023-03-09 11:44:18 +01:00
.mobile > ul {
display: none;
padding: 0px;
}
2023-03-04 20:11:51 +01:00
2023-03-09 11:44:18 +01:00
.mobile:focus-within > ul {
display: flex;
}
2023-03-04 20:11:51 +01:00
2023-03-09 11:44:18 +01:00
.mobile:focus-within > .placeholder {
display: none;
}
.mobile:focus-within {
justify-content: top;
height: auto;
}
header:focus-within > a {
display: flex;
justify-self: top;
}
2023-03-04 20:11:51 +01:00
2023-12-29 23:32:43 +01:00
.hamburger-menu {
2023-12-29 22:57:30 +01:00
mask: var(--hamburger_src_url) no-repeat center;
background-color: white;
width: 2rem;
height: 2rem;
2023-12-29 22:57:30 +01:00
position: static;
align-self: flex-start;
margin-right: 1rem;
margin-top: 1rem;
2023-12-29 22:57:30 +01:00
}
2023-07-08 15:02:07 +02:00
@media (min-width: 1140px) {
2023-03-09 11:44:18 +01:00
.mobile {
display: none;
}
2023-03-09 11:44:18 +01:00
.desktop {
display: flex;
2023-03-04 20:11:51 +01:00
}
2023-03-09 11:44:18 +01:00
header {
height: 64px;
align-items: center;
}
2023-03-09 11:44:18 +01:00
header > a {
padding-top: 0px;
2023-03-04 20:11:51 +01:00
}
2023-03-09 11:44:18 +01:00
}
</style>