WIP: header component and index structure
This commit is contained in:
parent
74b979704f
commit
a1e8e67b0c
3 changed files with 62 additions and 4 deletions
|
|
@ -1,19 +1,68 @@
|
||||||
---
|
---
|
||||||
|
const { pathname } = Astro.url;
|
||||||
|
const currentPath =
|
||||||
|
pathname.endsWith("/") && pathname.length > 1
|
||||||
|
? pathname.slice(0, -1)
|
||||||
|
: pathname;
|
||||||
|
const navItems = [
|
||||||
|
{ href: "/", label: "About" },
|
||||||
|
{ href: "/now", label: "Now" },
|
||||||
|
{ href: "/writing", label: "Writing" },
|
||||||
|
];
|
||||||
---
|
---
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
<h1>dnsc</h1>
|
<h1>dnsc</h1>
|
||||||
|
<ul>
|
||||||
|
{
|
||||||
|
navItems.map(({ href, label }) => (
|
||||||
|
<li>
|
||||||
|
<a href={href} class={currentPath === href ? "active" : ""}>
|
||||||
|
{label}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
header {
|
header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 1rem;
|
padding: 0.5rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
max-width: var(--container-lg);
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-family: var(--font-fancy);
|
font-family: var(--font-fancy);
|
||||||
|
font-size: 1.5rem;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
list-style-type: none;
|
||||||
|
justify-content: center;
|
||||||
|
padding-left: 0;
|
||||||
|
margin-bottom: 0.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul > li {
|
||||||
|
margin-left: 0.6rem;
|
||||||
|
margin-right: 0.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
a,
|
||||||
|
a:visited {
|
||||||
|
color: var(--foreground);
|
||||||
|
}
|
||||||
|
|
||||||
|
a.active {
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,14 @@ const { title } = Astro.props;
|
||||||
}
|
}
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
|
/* Oat UI */
|
||||||
--background: #ffffff;
|
--background: #ffffff;
|
||||||
|
--primary: #133d56;
|
||||||
|
|
||||||
|
/* Custom */
|
||||||
--font-fancy: "Desyrel", serif;
|
--font-fancy: "Desyrel", serif;
|
||||||
|
--container-lg: 1200px;
|
||||||
|
--container-md: 600px;
|
||||||
|
--container-sm: 480px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,12 @@ import Header from "../components/Header.astro";
|
||||||
|
|
||||||
<Layout title="Home">
|
<Layout title="Home">
|
||||||
<Header />
|
<Header />
|
||||||
|
<img src="https://placehold.co/1200x300" />
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
h1 {
|
img {
|
||||||
font-family: var(--font-fancy);
|
width: 100%;
|
||||||
|
max-width: var(--container-lg);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue