mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-blog.git
synced 2026-07-03 23:51:26 +00:00
94 lines
2 KiB
Text
94 lines
2 KiB
Text
---
|
|
import Navigation from "./Navigation.astro";
|
|
import ThemeIcon from "./ThemeIcon.astro";
|
|
import { getLangFromUrl, getTranslations } from "@/i18n";
|
|
|
|
const lang = getLangFromUrl(Astro.url);
|
|
const t = getTranslations(lang);
|
|
---
|
|
|
|
<header class="site-header">
|
|
<div class="theme-icon-wrap">
|
|
<ThemeIcon />
|
|
</div>
|
|
|
|
<nav class="header-nav">
|
|
<div class="banner">
|
|
<a
|
|
href={`/${lang}/`}
|
|
data-astro-reload
|
|
class="banner-link"
|
|
aria-label="banner"
|
|
>
|
|
<span class="banner-logo"></span>
|
|
</a>
|
|
</div>
|
|
<Navigation />
|
|
</nav>
|
|
</header>
|
|
|
|
<style>
|
|
.banner-link {
|
|
display: inline-block;
|
|
}
|
|
|
|
.banner-logo {
|
|
display: block;
|
|
height: 55px; /* 按你的 banner 比例改 */
|
|
background-color: #1f2328;
|
|
|
|
-webkit-mask: url("/images/banner-black.svg") no-repeat left / contain;
|
|
mask: url("/images/banner-black.svg") no-repeat left / contain;
|
|
}
|
|
|
|
:global(html.dark .banner-logo) {
|
|
background-color: #e6e6e6;
|
|
}
|
|
|
|
.header-nav .banner a {
|
|
color: inherit;
|
|
text-decoration: none;
|
|
display: block;
|
|
}
|
|
|
|
.site-header {
|
|
position: relative;
|
|
padding-top: 0.5rem;
|
|
}
|
|
|
|
.theme-icon-wrap {
|
|
position: absolute;
|
|
top: 0;
|
|
right: 0;
|
|
z-index: 2;
|
|
}
|
|
|
|
.header-nav {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.header-nav .banner {
|
|
margin: 0;
|
|
font-style: italic;
|
|
line-height: 1.1;
|
|
|
|
/* 给右上角 ThemeIcon 留空间 */
|
|
max-width: calc(100% - 7rem);
|
|
|
|
/* 桌面正常,手机自动缩小 */
|
|
font-size: clamp(1.6rem, 6vw, 2.5rem);
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.site-header {
|
|
padding-top: 0.25rem;
|
|
}
|
|
|
|
.header-nav h1 {
|
|
max-width: calc(100% - 3.5rem);
|
|
font-size: clamp(1.25rem, 7vw, 2rem);
|
|
}
|
|
}
|
|
</style>
|