apply formatting rules
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
---
|
||||
|
||||
import BarsIcon from "../../assets/svg/bars.svg";
|
||||
import CloseIcon from "../../assets/svg/xmark.svg";
|
||||
|
||||
@@ -8,94 +7,94 @@ import { navLinks } from "../../data/nav-links";
|
||||
|
||||
<!-- drawerOpened is defined in /src/layouts/Layout.astro -->
|
||||
<div class="drawer-container" @keydown.escape="drawerOpen = false">
|
||||
<button class="icon-button" @click="drawerOpen = !drawerOpen">
|
||||
<BarsIcon width={24} height={24} />
|
||||
</button>
|
||||
<div
|
||||
class="overlay"
|
||||
@click="drawerOpen = !drawerOpen"
|
||||
x-show="drawerOpen"
|
||||
x-transition:enter-start="hidden-overlay"
|
||||
x-transition:enter-end="visible-overlay"
|
||||
x-transition:leave-start="visible-overlay"
|
||||
x-transition:leave-end="hidden-overlay"
|
||||
>
|
||||
</div>
|
||||
<div
|
||||
class="drawer"
|
||||
x-show="drawerOpen"
|
||||
x-transition:enter-start="hidden-drawer"
|
||||
x-transition:enter-end="visible-drawer"
|
||||
x-transition:leave-start="visible-drawer"
|
||||
x-transition:leave-end="hidden-drawer"
|
||||
>
|
||||
<div>
|
||||
<button class="icon-button" @click="drawerOpen = !drawerOpen">
|
||||
<CloseIcon width={24} height={24} /></button
|
||||
>
|
||||
</div>
|
||||
<nav>
|
||||
{navLinks.map((link) => <a href={`/${link.path}`}>{link.label}</a>)}
|
||||
</nav>
|
||||
</div>
|
||||
<button class="icon-button" @click="drawerOpen = !drawerOpen">
|
||||
<BarsIcon width={24} height={24} />
|
||||
</button>
|
||||
<div
|
||||
class="overlay"
|
||||
@click="drawerOpen = !drawerOpen"
|
||||
x-show="drawerOpen"
|
||||
x-transition:enter-start="hidden-overlay"
|
||||
x-transition:enter-end="visible-overlay"
|
||||
x-transition:leave-start="visible-overlay"
|
||||
x-transition:leave-end="hidden-overlay"
|
||||
>
|
||||
</div>
|
||||
<div
|
||||
class="drawer"
|
||||
x-show="drawerOpen"
|
||||
x-transition:enter-start="hidden-drawer"
|
||||
x-transition:enter-end="visible-drawer"
|
||||
x-transition:leave-start="visible-drawer"
|
||||
x-transition:leave-end="hidden-drawer"
|
||||
>
|
||||
<div>
|
||||
<button class="icon-button" @click="drawerOpen = !drawerOpen">
|
||||
<CloseIcon width={24} height={24} /></button
|
||||
>
|
||||
</div>
|
||||
<nav>
|
||||
{navLinks.map((link) => <a href={`/${link.path}`}>{link.label}</a>)}
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
:root {
|
||||
--transition: all 0.3s ease-in-out;
|
||||
}
|
||||
:root {
|
||||
--transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.drawer-container {
|
||||
display: none;
|
||||
}
|
||||
.drawer-container {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
z-index: 2;
|
||||
transition: var(--transition);
|
||||
}
|
||||
.overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
z-index: 2;
|
||||
transition: var(--transition);
|
||||
}
|
||||
|
||||
.hidden-overlay {
|
||||
opacity: 0;
|
||||
}
|
||||
.hidden-overlay {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.drawer {
|
||||
right: 0;
|
||||
top: 0;
|
||||
background-color: var(--background);
|
||||
position: absolute;
|
||||
width: 75vw;
|
||||
height: 100vh;
|
||||
z-index: 3;
|
||||
transition: var(--transition);
|
||||
}
|
||||
.drawer {
|
||||
right: 0;
|
||||
top: 0;
|
||||
background-color: var(--background);
|
||||
position: absolute;
|
||||
width: 75vw;
|
||||
height: 100vh;
|
||||
z-index: 3;
|
||||
transition: var(--transition);
|
||||
}
|
||||
|
||||
.drawer > div {
|
||||
padding: 8px 6px 4px;
|
||||
border-bottom: var(--border);
|
||||
}
|
||||
.drawer > div {
|
||||
padding: 8px 6px 4px;
|
||||
border-bottom: var(--border);
|
||||
}
|
||||
|
||||
nav {
|
||||
text-align: center;
|
||||
padding: 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
nav {
|
||||
text-align: center;
|
||||
padding: 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.hidden-drawer {
|
||||
transform: translateX(75vw);
|
||||
}
|
||||
.hidden-drawer {
|
||||
transform: translateX(75vw);
|
||||
}
|
||||
|
||||
@media screen and (max-width: 768px) {
|
||||
.drawer-container {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 768px) {
|
||||
.drawer-container {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,50 +1,49 @@
|
||||
---
|
||||
|
||||
import Drawer from "./Drawer.astro";
|
||||
import Nav from "./Nav.astro";
|
||||
---
|
||||
|
||||
<header>
|
||||
<div class="container">
|
||||
<a href="/">ghall.space</a>
|
||||
<Nav />
|
||||
<Drawer />
|
||||
</div>
|
||||
<div class="container">
|
||||
<a href="/">ghall.space</a>
|
||||
<Nav />
|
||||
<Drawer />
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<style>
|
||||
header {
|
||||
margin-bottom: 20px;
|
||||
height: 70px;
|
||||
background-color: rgba(252, 252, 252, 90%);
|
||||
backdrop-filter: blur(10px);
|
||||
width: 100%;
|
||||
top: 0;
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
border-bottom: var(--border);
|
||||
}
|
||||
header {
|
||||
margin-bottom: 20px;
|
||||
height: 70px;
|
||||
background-color: rgba(252, 252, 252, 90%);
|
||||
backdrop-filter: blur(10px);
|
||||
width: 100%;
|
||||
top: 0;
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
border-bottom: var(--border);
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
max-width: var(--max-page-width);
|
||||
margin: auto;
|
||||
padding: 0 16px;
|
||||
height: 100%;
|
||||
}
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
max-width: var(--max-page-width);
|
||||
margin: auto;
|
||||
padding: 0 16px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
a {
|
||||
font-size: 1.6rem;
|
||||
color: var(--text);
|
||||
font-weight: bold;
|
||||
}
|
||||
a {
|
||||
font-size: 1.6rem;
|
||||
color: var(--text);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
header {
|
||||
background-color: rgba(30, 30, 46, 90%);
|
||||
}
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
header {
|
||||
background-color: rgba(30, 30, 46, 90%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,65 +1,64 @@
|
||||
---
|
||||
|
||||
import { navLinks } from '../../data/nav-links';
|
||||
import { navLinks } from "../../data/nav-links";
|
||||
|
||||
const { pathname } = Astro.url;
|
||||
|
||||
const pathComponents = pathname.split('/').slice(1);
|
||||
const pathComponents = pathname.split("/").slice(1);
|
||||
---
|
||||
|
||||
<nav>
|
||||
{
|
||||
navLinks.map((link) => (
|
||||
<li>
|
||||
<a
|
||||
href={`/${link.path}`}
|
||||
class={pathComponents[0] === link.path ? 'selected' : null}
|
||||
>
|
||||
{link.label}
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
{
|
||||
navLinks.map((link) => (
|
||||
<li>
|
||||
<a
|
||||
href={`/${link.path}`}
|
||||
class={pathComponents[0] === link.path ? "selected" : null}
|
||||
>
|
||||
{link.label}
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</nav>
|
||||
|
||||
<style>
|
||||
nav {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
list-style: none;
|
||||
gap: 10px;
|
||||
font-size: 1.15rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
nav {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
list-style: none;
|
||||
gap: 10px;
|
||||
font-size: 1.15rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--text);
|
||||
padding: 5px 10px;
|
||||
border-radius: var(--radius);
|
||||
transition: background-color 0.2s ease-in-out;
|
||||
}
|
||||
a {
|
||||
color: var(--text);
|
||||
padding: 5px 10px;
|
||||
border-radius: var(--radius);
|
||||
transition: background-color 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
background-color: rgba(0, 0, 0, 0.04);
|
||||
opacity: 1;
|
||||
}
|
||||
a:hover {
|
||||
background-color: rgba(0, 0, 0, 0.04);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.underline {
|
||||
height: 2px;
|
||||
width: 100%;
|
||||
background-color: var(--orange);
|
||||
}
|
||||
.underline {
|
||||
height: 2px;
|
||||
width: 100%;
|
||||
background-color: var(--orange);
|
||||
}
|
||||
|
||||
@media screen and (max-width: 768px) {
|
||||
nav {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 768px) {
|
||||
nav {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
a:hover {
|
||||
background-color: rgba(231, 237, 255, 0.1);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
a:hover {
|
||||
background-color: rgba(231, 237, 255, 0.1);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user