~repos /website

#astro#js#html#css

git clone https://pyrossh.dev/repos/website.git

木 Personal website of pyrossh. Built with astrojs, shiki, vite.



src/components/Header.astro



---
import { Icon } from "astro-icon/components";
import { ThemeSwitch } from "astro-color-scheme";
import HeaderLink from "./HeaderLink.astro";
import Wrapper from "./Wrapper.astro";
---
<div class="safe-area"></div>
<header>
<Wrapper>
<nav>
<HeaderLink class="logo" href="/"> 木 pyrossh </HeaderLink>
<div class="links">
<ThemeSwitch strategy="button">
<button id="theme-change">
<Icon
style="display: var(--btn-light);"
name="material-symbols:sunny-rounded"
/>
<Icon
style="display: var(--btn-dark);"
name="material-symbols:moon-stars"
/>
</button>
</ThemeSwitch>
<div>|</div>
<HeaderLink href="/cv">cv</HeaderLink>
<div>|</div>
<HeaderLink href="/posts">posts</HeaderLink>
</div>
</nav>
</Wrapper>
</header>
<style>
header {
background: #131618;
}
.safe-area {
background: #131618;
position: sticky;
top: 0;
padding-top: env(safe-area-inset-top);
}
.logo {
display: flex;
font-size: 22px;
line-height: 56px;
font-weight: 400;
margin-bottom: 0;
float: left;
color: var(--color-accent);
margin-right: 8px;
&.active,
&:hover {
color: var(--color-accent);
text-decoration: underline;
text-decoration-color: var(--color-accent);
text-underline-offset: 8px;
}
}
.links {
display: flex;
flex-direction: row;
float: right;
font-size: 1.4rem;
line-height: 56px;
color: white;
#astro-color-scheme-switch {
display: flex;
align-items: center;
font-size: 1.3rem;
button {
padding-right: 12px;
cursor: pointer;
margin-bottom: -2px;
}
}
a {
display: inline-block;
text-decoration: none;
font-size: 22px;
line-height: 56px;
color: white;
font-weight: 400;
padding-left: 12px;
padding-right: 12px;
&:last-child {
padding-right: 0px;
}
&.active,
&:hover {
color: var(--color-gray-200);
text-decoration: underline;
text-decoration-color: var(--color-accent);
text-underline-offset: 8px;
}
}
}
</style>