complete many assets
This commit is contained in:
@@ -6,106 +6,152 @@ export interface Props {
|
||||
className?: string;
|
||||
}
|
||||
|
||||
import GlowButton from './common/GlowButton.astro';
|
||||
|
||||
const {
|
||||
title = 'Jiao77 - AI & Technology Explorer'
|
||||
title = 'Jiao77 - AI & Technology Explorer',
|
||||
description,
|
||||
navigationItems,
|
||||
className = ''
|
||||
} = Astro.props;
|
||||
|
||||
const defaultNavigation = [
|
||||
{ label: '首页', href: '/', icon: 'fas fa-home' },
|
||||
{ label: '报告导航', href: '/report', icon: 'fas fa-chart-line' },
|
||||
{ label: '关于我', href: '/about', icon: 'fas fa-user-astronaut' },
|
||||
{ label: '组件测试', href: '/components-demo', icon: 'fas fa-user-astronaut' },
|
||||
];
|
||||
|
||||
const links = navigationItems && navigationItems.length > 0 ? navigationItems : defaultNavigation;
|
||||
---
|
||||
|
||||
<header class="header-container">
|
||||
<!-- 收缩状态的页眉 -->
|
||||
<div class="header-collapsed" id="header-collapsed">
|
||||
<div class="header-content">
|
||||
<div class="header-brand">
|
||||
<header id="site-header" class={`site-header ${className}`}>
|
||||
<div class="header-inner">
|
||||
<div class="header-brand">
|
||||
<a href="/" class="brand-link" aria-label="返回首页">
|
||||
<h1 class="brand-title">{title}</h1>
|
||||
</div>
|
||||
|
||||
<button class="expand-button" id="expand-button">
|
||||
<i class="fas fa-bars"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 展开状态的页眉 -->
|
||||
<div class="header-expanded" id="header-expanded">
|
||||
<div class="header-content">
|
||||
<div class="header-brand">
|
||||
<h1 class="brand-title">{title}</h1>
|
||||
</div>
|
||||
|
||||
<nav class="main-nav" aria-label="主导航">
|
||||
<a href="/" class="nav-item" aria-label="首页">
|
||||
<i class="fas fa-home"></i>
|
||||
<span>首页</span>
|
||||
</a>
|
||||
<a href="/reports" class="nav-item" aria-label="报告">
|
||||
<i class="fas fa-chart-line"></i>
|
||||
<span>报告</span>
|
||||
</a>
|
||||
<a href="/components-demo" class="nav-item" aria-label="组件示例">
|
||||
<i class="fas fa-cube"></i>
|
||||
<span>组件</span>
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<button class="collapse-button" id="collapse-button">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</a>
|
||||
{description && (
|
||||
<p class="brand-description">{description}</p>
|
||||
)}
|
||||
</div>
|
||||
<nav class="main-nav" aria-label="主导航">
|
||||
{links.map((item) => (
|
||||
<GlowButton
|
||||
href={item.href}
|
||||
icon={item.icon}
|
||||
ariaLabel={item.label}
|
||||
className="nav-button"
|
||||
size="sm"
|
||||
variant="translucent"
|
||||
>
|
||||
{item.label}
|
||||
</GlowButton>
|
||||
))}
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<style>
|
||||
.header-container {
|
||||
.site-header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 1000;
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
.header-collapsed {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
backdrop-filter: blur(10px);
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
|
||||
padding: 1rem 0;
|
||||
z-index: 1200;
|
||||
background: rgba(248, 250, 255, 0.18);
|
||||
backdrop-filter: blur(30px) saturate(150%);
|
||||
border-bottom: 1px solid rgba(148, 163, 184, 0.28);
|
||||
box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18);
|
||||
transform: translateY(0);
|
||||
transition: all 0.3s ease;
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
transition: transform 0.45s cubic-bezier(0.4, 0.14, 0.2, 1), opacity 0.45s ease;
|
||||
overflow: clip;
|
||||
}
|
||||
|
||||
.header-expanded {
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
backdrop-filter: blur(15px);
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.3);
|
||||
padding: 1.5rem 0;
|
||||
transform: translateY(-100%);
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
|
||||
|
||||
.site-header::before,
|
||||
.site-header::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.header-expanded.active {
|
||||
|
||||
.site-header::before {
|
||||
background:
|
||||
radial-gradient(
|
||||
circle at var(--pointer-x, 50%) var(--pointer-y, -40%),
|
||||
rgba(96, 165, 250, 0.65),
|
||||
rgba(59, 130, 246, 0.05) 42%,
|
||||
transparent 65%
|
||||
),
|
||||
radial-gradient(
|
||||
320px circle at calc(var(--pointer-x, 50%) + 10%) calc(var(--pointer-y, -40%) + 8%),
|
||||
rgba(236, 72, 153, 0.35),
|
||||
transparent 60%
|
||||
);
|
||||
filter: saturate(120%) blur(0.65rem);
|
||||
mix-blend-mode: screen;
|
||||
opacity: calc(var(--pointer-intensity, 0) * 0.75);
|
||||
transition: opacity 0.6s ease;
|
||||
}
|
||||
|
||||
.site-header::after {
|
||||
background: linear-gradient(120deg, rgba(255, 255, 255, 0.12), transparent 60%)
|
||||
, radial-gradient(80% 160% at 120% -40%, rgba(59, 130, 246, 0.18), transparent 70%);
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.site-header.hidden {
|
||||
transform: translateY(-110%);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.site-header.visible {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
box-shadow: 0 24px 48px rgba(15, 23, 42, 0.22);
|
||||
}
|
||||
|
||||
.header-collapsed.hidden {
|
||||
transform: translateY(-100%);
|
||||
|
||||
.site-header.pinned {
|
||||
box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
|
||||
}
|
||||
|
||||
.header-content {
|
||||
|
||||
.site-header.showing {
|
||||
animation: header-slide-in 0.55s cubic-bezier(0.22, 1, 0.36, 1);
|
||||
}
|
||||
|
||||
.site-header.hiding {
|
||||
animation: header-slide-out 0.45s cubic-bezier(0.65, 0, 0.35, 1);
|
||||
}
|
||||
|
||||
.header-inner {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 2rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 2rem;
|
||||
min-height: 72px;
|
||||
}
|
||||
|
||||
.header-brand {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.brand-link {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.brand-title {
|
||||
font-size: 1.5rem;
|
||||
font-size: clamp(1.35rem, 2.4vw, 1.85rem);
|
||||
font-weight: 700;
|
||||
color: #011a2d;
|
||||
margin: 0;
|
||||
@@ -113,81 +159,98 @@ const {
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
line-height: 1.15;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.brand-description {
|
||||
margin: 0;
|
||||
font-size: 0.9rem;
|
||||
color: #334155;
|
||||
max-width: 32rem;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.navigation {
|
||||
.main-nav {
|
||||
display: flex;
|
||||
gap: 2rem;
|
||||
gap: 0.75rem;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.75rem 1.5rem;
|
||||
border-radius: 1rem;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
color: #011a2d;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
transition: all 0.3s ease;
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
|
||||
.nav-button {
|
||||
min-width: 0;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.01em;
|
||||
}
|
||||
|
||||
.nav-item:hover {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
|
||||
|
||||
.nav-button :global(.glow-button__content) {
|
||||
gap: 0.4rem;
|
||||
color: #0f172a;
|
||||
}
|
||||
|
||||
.expand-button,
|
||||
.collapse-button {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
border-radius: 0.75rem;
|
||||
padding: 0.75rem;
|
||||
color: #011a2d;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
font-size: 1.1rem;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.nav-button :global(.glow-button__icon) {
|
||||
font-size: 0.9rem;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.expand-button:hover,
|
||||
.collapse-button:hover {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
transform: scale(1.05);
|
||||
|
||||
@keyframes header-slide-in {
|
||||
0% {
|
||||
transform: translateY(-110%);
|
||||
opacity: 0;
|
||||
filter: blur(6px);
|
||||
}
|
||||
60% {
|
||||
filter: blur(0);
|
||||
}
|
||||
100% {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
filter: blur(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes header-slide-out {
|
||||
0% {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
filter: blur(0);
|
||||
}
|
||||
100% {
|
||||
transform: translateY(-120%);
|
||||
opacity: 0;
|
||||
filter: blur(6px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.navigation {
|
||||
.header-inner {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 1rem;
|
||||
width: 100%;
|
||||
margin-top: 1rem;
|
||||
padding: 0.75rem 1.25rem 1.25rem;
|
||||
min-height: unset;
|
||||
}
|
||||
|
||||
.header-content {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 1rem;
|
||||
padding: 0 1rem;
|
||||
|
||||
.brand-title {
|
||||
font-size: 1.35rem;
|
||||
}
|
||||
|
||||
.header-brand {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.brand-description {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
width: 100%;
|
||||
|
||||
.main-nav {
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.nav-button {
|
||||
flex: 1 1 auto;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user