feat(display): site name and avatar in the top bar, content aligned left [CI SKIP]

This commit is contained in:
justme committed 2026-10-09 03:08:54 +08:00
1 parent 7ff03a9628
commit 70f20d38d0
5 files changed
+22 -4

No files matched your search

+1
View File
@@ -4,6 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>MoShiro</title> <title>MoShiro</title>
<link rel="icon" type="image/png" href="/src/assets/avatar-64.png" />
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
+6 -1
View File
@@ -1,3 +1,5 @@
import { useRef } from 'react'
import avatar from './assets/avatar.png'
import { BuildFooter } from './BuildFooter' import { BuildFooter } from './BuildFooter'
import { NavLink, Navigate, Route, Routes, useLocation, useParams } from 'react-router-dom' import { NavLink, Navigate, Route, Routes, useLocation, useParams } from 'react-router-dom'
import { SourceButton, ThemeToggle } from '@shared/ui' import { SourceButton, ThemeToggle } from '@shared/ui'
@@ -22,10 +24,13 @@ export function App() {
<NavLink to={`/${familyQuery}`} end className={({ isActive }) => (isActive ? 'active' : '')}> <NavLink to={`/${familyQuery}`} end className={({ isActive }) => (isActive ? 'active' : '')}>
总览 总览
</NavLink> </NavLink>
<NavLink to={`/${familyQuery}`} className="brand">
<img className="brand-logo" src={avatar} alt="" width={36} height={36} />
<span>MoShiro</span>
</NavLink>
<NavLink to={`/compare${familyQuery}`} className={({ isActive }) => (isActive ? 'active' : '')}> <NavLink to={`/compare${familyQuery}`} className={({ isActive }) => (isActive ? 'active' : '')}>
对比 对比
</NavLink> </NavLink>
<a href="/admin/">管理</a>
</nav> </nav>
<SourceButton variant="status" /> <SourceButton variant="status" />
<ThemeToggle /> <ThemeToggle />
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

+15 -3
View File
@@ -10,8 +10,7 @@
} }
.topbar .inner { .topbar .inner {
max-width: 1200px; /* 不再限宽居中:站点名和头像贴着左边,导航、状态和主题按钮整体靠右 */
margin: 0 auto;
padding: 0 24px; padding: 0 24px;
height: 60px; height: 60px;
display: flex; display: flex;
@@ -20,11 +19,23 @@
} }
.brand { .brand {
display: flex;
align-items: center;
gap: 10px;
font-size: 18px; font-size: 18px;
font-weight: 700; font-weight: 700;
letter-spacing: 0.01em;
color: var(--app-ink); color: var(--app-ink);
} }
.brand-logo {
width: 36px;
height: 36px;
object-fit: contain;
/* 头像是透明底的立绘,给一点投影让它在背景图上更清楚 */
filter: drop-shadow(0 2px 4px color-mix(in srgb, var(--app-shadow) 35%, transparent));
}
.brand:hover { .brand:hover {
text-decoration: none; text-decoration: none;
} }
@@ -52,9 +63,10 @@
color: var(--app-on-accent-container); color: var(--app-on-accent-container);
} }
/* 内容贴着屏幕左边排列(不居中),右边留给背景图 */
.page { .page {
max-width: 1200px; max-width: 1200px;
margin: 0 auto; margin: 0;
padding: 40px 24px 80px; padding: 40px 24px 80px;
} }