style(home): 大标题改像素字体+彩虹渐变;页眉改 portrait 浮动玻璃胶囊
- 自托管像素字体 BubbledotICG-FinePos(public/fonts/bubbledot.woff2),@font-face + --font-pixel - 首页 hero 标题 .mk-display 用像素字体,第二行文字保留彩虹渐变(background-clip:text),字号/行距适配像素字 - 页眉重构为 portrait 浮动玻璃胶囊(单个圆角胶囊内含 logo+导航+个人中心+明暗切换,悬浮于顶部) - 全局 header/nav/footer 样式同步调整;移动端折叠为汉堡+主题切换
This commit is contained in:
Binary file not shown.
@@ -1,6 +1,5 @@
|
||||
import React from 'react';
|
||||
import { Logo } from '../atoms';
|
||||
import { NavPill } from '../molecules';
|
||||
import { NAV, PINE_NAV } from '../../data/site';
|
||||
import { logout, getUser } from '../../services/auth';
|
||||
import { getTheme, toggleTheme } from '../../services/theme';
|
||||
@@ -28,25 +27,31 @@ export function Header({ active }) {
|
||||
return (
|
||||
<>
|
||||
<header className="site-header">
|
||||
<div className="header-inner">
|
||||
<div className="header-pill">
|
||||
<Logo />
|
||||
<NavPill active={active} nav={nav} />
|
||||
{pine ? (
|
||||
<button className="btn-sign" onClick={doLogout}>退出</button>
|
||||
) : (
|
||||
<>
|
||||
{user && <a className="user-nick" href="#/profile" title={user.username}>{user.name}</a>}
|
||||
<a className="btn-sign" href="#/profile">个人中心</a>
|
||||
</>
|
||||
)}
|
||||
<button
|
||||
className="theme-toggle"
|
||||
aria-label={dark ? '切换为浅色' : '切换为深色'}
|
||||
onClick={onToggleTheme}
|
||||
title={dark ? '浅色' : '深色'}
|
||||
>
|
||||
{dark ? '☀' : '☾'}
|
||||
</button>
|
||||
<nav className="header-nav" aria-label="主导航">
|
||||
{nav.map((n) => (
|
||||
<a key={n.path} className={`nav-link${active === n.path ? ' active' : ''}`} href={`#/${n.path}`}>{n.label}</a>
|
||||
))}
|
||||
</nav>
|
||||
<div className="header-actions">
|
||||
{pine ? (
|
||||
<button className="btn-sign" onClick={doLogout}>退出</button>
|
||||
) : (
|
||||
<>
|
||||
{user && <a className="user-nick" href="#/profile" title={user.username}>{user.name}</a>}
|
||||
<a className="btn-sign" href="#/profile">个人中心</a>
|
||||
</>
|
||||
)}
|
||||
<button
|
||||
className="theme-toggle"
|
||||
aria-label={dark ? '切换为浅色' : '切换为深色'}
|
||||
onClick={onToggleTheme}
|
||||
title={dark ? '浅色' : '深色'}
|
||||
>
|
||||
{dark ? '☀' : '☾'}
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
className={`burger${open ? ' open' : ''}`}
|
||||
aria-label={open ? '关闭菜单' : '打开菜单'}
|
||||
|
||||
@@ -236,38 +236,62 @@ input[type="range"] { accent-color: var(--primary); }
|
||||
.check-grid label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-soft); cursor: pointer; }
|
||||
.check-grid input { width: 16px; height: 16px; accent-color: var(--primary); }
|
||||
|
||||
/* ---------- 组织:Header / MobileMenu / Hero / Stats / Footer ---------- */
|
||||
/* ---------- 组织:Header(portrait 浮动玻璃胶囊) ---------- */
|
||||
.site-header {
|
||||
position: sticky; top: 0; z-index: 20;
|
||||
width: 100%; display: flex; justify-content: center;
|
||||
padding: clamp(12px, 2vh, 20px) 0 clamp(10px, 1.6vh, 16px);
|
||||
background: var(--glass-bg);
|
||||
backdrop-filter: blur(14px) saturate(140%);
|
||||
-webkit-backdrop-filter: blur(14px) saturate(140%);
|
||||
padding: clamp(14px, 2.4vh, 24px) clamp(12px, 2vw, 20px) 0;
|
||||
background: transparent;
|
||||
}
|
||||
.header-inner {
|
||||
.header-pill {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
width: 100%; max-width: 1000px;
|
||||
gap: clamp(18px, 2.8vw, 28px);
|
||||
width: 100%; max-width: 1180px;
|
||||
gap: clamp(12px, 2vw, 20px);
|
||||
padding: 9px 10px 9px 18px;
|
||||
border-radius: var(--radius-3xl);
|
||||
background: var(--glass-bg);
|
||||
backdrop-filter: blur(18px) saturate(160%);
|
||||
-webkit-backdrop-filter: blur(18px) saturate(160%);
|
||||
box-shadow: var(--glass-shadow), 0 0 0 1px var(--glass-ring);
|
||||
animation: slideDown 0.7s var(--ease) both;
|
||||
}
|
||||
.logo {
|
||||
flex: 0 0 auto;
|
||||
width: clamp(40px, 4.4vw, 46px); height: clamp(40px, 4.4vw, 46px);
|
||||
border-radius: 50%; background: var(--surface);
|
||||
box-shadow: var(--shadow-sm-border);
|
||||
width: clamp(38px, 4.2vw, 44px); height: clamp(38px, 4.2vw, 44px);
|
||||
border-radius: 999px; background: var(--heading);
|
||||
display: grid; place-items: center;
|
||||
transition: transform 0.25s var(--ease);
|
||||
}
|
||||
.logo:hover { transform: scale(1.04); }
|
||||
.logo img { width: 72%; height: 72%; object-fit: contain; }
|
||||
.logo span { font-family: var(--font-display); font-weight: 700; color: var(--heading); font-size: 18px; }
|
||||
.logo:hover { transform: scale(1.05); }
|
||||
.logo img { width: 66%; height: 66%; object-fit: contain; }
|
||||
.logo span { font-family: var(--font-pixel); font-weight: 700; color: #fff; font-size: 16px; }
|
||||
.header-nav {
|
||||
display: flex; align-items: center; gap: 2px;
|
||||
flex: 1; justify-content: center;
|
||||
}
|
||||
.nav-link {
|
||||
position: relative;
|
||||
font-weight: 500; font-size: clamp(13px, 1.3vw, 15px);
|
||||
letter-spacing: -0.01em; color: var(--heading);
|
||||
padding: 8px 14px; border-radius: 999px;
|
||||
opacity: 0.6; transition: opacity 0.2s ease, background 0.2s ease;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.nav-link:hover { opacity: 1; background: var(--panel-2); }
|
||||
.nav-link.active { opacity: 1; }
|
||||
.nav-link.active::after {
|
||||
content: ""; position: absolute; left: 50%; bottom: 4px;
|
||||
transform: translateX(-50%);
|
||||
width: 3px; height: 3px; border-radius: 50%; background: var(--heading);
|
||||
box-shadow: -5px 0 0 var(--heading), 5px 0 0 var(--heading);
|
||||
}
|
||||
.header-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
|
||||
.btn-sign {
|
||||
flex: 0 0 auto;
|
||||
height: clamp(40px, 5.2vw, 46px);
|
||||
padding: 0 20px; border-radius: 999px; border: none;
|
||||
height: clamp(38px, 4.8vw, 44px);
|
||||
padding: 0 18px; border-radius: 999px; border: none;
|
||||
background: #2c2c2c; color: #fff;
|
||||
font-weight: 500; font-size: clamp(13px, 1.4vw, 15px);
|
||||
font-weight: 500; font-size: clamp(13px, 1.3vw, 15px);
|
||||
box-shadow: var(--shadow-sm);
|
||||
display: inline-flex; align-items: center; gap: 8px;
|
||||
transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
|
||||
@@ -277,26 +301,25 @@ input[type="range"] { accent-color: var(--primary); }
|
||||
[data-theme="dark"] .btn-sign:hover { background: rgba(255,255,255,0.22); }
|
||||
.theme-toggle {
|
||||
flex: 0 0 auto;
|
||||
width: clamp(40px, 5.2vw, 44px); height: clamp(40px, 5.2vw, 44px);
|
||||
width: clamp(36px, 4.6vw, 42px); height: clamp(36px, 4.6vw, 42px);
|
||||
border-radius: 50%; border: 1px solid var(--glass-ring);
|
||||
background: var(--surface); color: var(--heading);
|
||||
background: var(--panel); color: var(--heading);
|
||||
display: inline-flex; align-items: center; justify-content: center;
|
||||
font-size: 18px; box-shadow: var(--shadow-xs);
|
||||
font-size: 17px;
|
||||
transition: transform 0.2s var(--ease), background 0.2s ease;
|
||||
}
|
||||
.theme-toggle:hover { transform: translateY(-1px); background: var(--panel-2); }
|
||||
.user-nick {
|
||||
flex: 0 0 auto;
|
||||
font-family: var(--font-display);
|
||||
font-size: clamp(15px, 1.8vw, 18px);
|
||||
letter-spacing: 0.04em;
|
||||
font-size: clamp(14px, 1.6vw, 17px);
|
||||
letter-spacing: 0.02em;
|
||||
color: var(--heading);
|
||||
border: 1px solid var(--glass-ring);
|
||||
border-radius: 999px;
|
||||
padding: 8px 18px;
|
||||
background: var(--surface);
|
||||
padding: 7px 16px;
|
||||
background: var(--panel);
|
||||
white-space: nowrap;
|
||||
box-shadow: var(--shadow-xs);
|
||||
}
|
||||
.burger { display: none; }
|
||||
|
||||
@@ -470,8 +493,8 @@ input[type="range"] { accent-color: var(--primary); }
|
||||
.grid-c3, .grid-c4 { grid-template-columns: repeat(2, 1fr); }
|
||||
}
|
||||
@media (max-width: 720px) {
|
||||
.nav-pill, .btn-sign, .user-nick, .theme-toggle { display: none; }
|
||||
.header-inner { max-width: 100%; }
|
||||
.header-nav, .btn-sign, .user-nick { display: none; }
|
||||
.header-pill { max-width: 100%; }
|
||||
.burger {
|
||||
display: block;
|
||||
width: 48px; height: 48px; border-radius: 50%;
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
font-size: 12.5px; letter-spacing: .02em; margin-bottom: 24px;
|
||||
}
|
||||
.mk-display {
|
||||
font-family: var(--font-sans);
|
||||
font-family: var(--font-pixel);
|
||||
color: var(--heading);
|
||||
font-size: clamp(40px, 8vw, 104px);
|
||||
line-height: 1.02; letter-spacing: -.05em; font-weight: 500;
|
||||
font-size: clamp(30px, 6.4vw, 74px);
|
||||
line-height: 1.06; letter-spacing: 0; font-weight: 400;
|
||||
max-width: 1080px;
|
||||
}
|
||||
.mk-display span { display: block; }
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
@font-face { font-family: "JetBrainsMono"; src: url("/fonts/aa4388db5528a0d5-s.woff2") format("woff2"); font-display: swap; font-weight: 100 900; font-style: normal; }
|
||||
@font-face { font-family: "JetBrainsMono"; src: url("/fonts/7a463bbf4bbf834c-s.woff2") format("woff2"); font-display: swap; font-weight: 100 900; font-style: italic; }
|
||||
@font-face { font-family: "Junicode"; src: url("/fonts/ef15920566b1745f-s.woff2") format("woff2"); font-display: swap; font-weight: 300 700; font-style: italic; }
|
||||
/* 品牌像素字体(自托管,用于品牌大标题,做彩虹渐变字) */
|
||||
@font-face { font-family: "BubbledotICG-FinePos"; src: url("/fonts/bubbledot.woff2") format("woff2"); font-display: swap; font-weight: 400; font-style: normal; }
|
||||
|
||||
/* ---------- 明暗主题(default = 浅色) ---------- */
|
||||
:root {
|
||||
@@ -77,6 +79,7 @@
|
||||
/* 字体族 */
|
||||
--font-sans: "Switzer", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
|
||||
--font-display: "BasierCircle", "Switzer", ui-sans-serif, system-ui, sans-serif;
|
||||
--font-pixel: "BubbledotICG-FinePos", "Switzer", monospace;
|
||||
--font-mono: "JetBrainsMono", ui-monospace, "SF Mono", monospace;
|
||||
--font-rounded: "OpenRunde", "Switzer", sans-serif;
|
||||
--font-serif-italic: "Junicode", Georgia, serif;
|
||||
|
||||
Reference in New Issue
Block a user