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

134 lines
2.3 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-03-04 13:48:57 +01:00
---
<header>
2023-03-09 11:44:18 +01:00
<a href="/" rel="noopener noreferrer" aria-label="Home">
<Image src={logo} alt="Website Logo"/>
2023-03-09 11:44:18 +01:00
</a>
<ul class="desktop">
<slot />
</ul>
2023-07-08 21:20:23 +02:00
<button class="mobile" aria-label="Navigation Button" tabindex="0" onclick="this.focus()">
2023-03-09 11:44:18 +01:00
<ul>
<slot />
2023-03-04 13:48:57 +01:00
</ul>
2023-03-09 11:44:18 +01:00
<div class="placeholder"></div>
<i class="iconoir-menu"></i>
</button>
2023-03-04 13:48:57 +01:00
</header>
<style>
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 {
padding-left: 16px;
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 > i {
2023-07-08 21:34:29 +02:00
position: static;
2023-03-09 11:44:18 +01:00
color: white;
font-weight: bold;
font-size: 2em;
align-self: flex-start;
padding-right: 1em;
2023-07-08 21:34:29 +02:00
padding-top: 1.15rem;
2023-03-09 11:44:18 +01:00
}
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-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>