refactor: navbar 行主体换共享列轨 grid——每行条目区统一 grid-cols-[repeat(6,minmax(0,180px))](替代逐行 --cols 内联变量+maxWidth 裁宽,各行列轨数不一导致跨行条目起点漂移),六章/月份/设计页/本页子项在同一 x 起点跨行左对齐,第 7 项折行仍落第 2 列轨;状态语言对调——二级标题(RowLabel)去背景改纯边框(常态 border-ink/30 框、hover/active 全墨线,活跃组不再靠 bg-paper-deep+inset ring),二级内容只留背景(SELECTED 删 inset ring,章节色项本就纯底色),标题=框、内容=色块的层级一眼可分;标签列 88→96px 容纳边框后四字不折行;移动抽屉条目收敛 2 列;视觉基线 navbar 全站入镜,--update-snapshots=all 整批重建,全量 e2e 93/93 绿
CI / check (pull_request) Failing after 3m34s
No files matched your search
|
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 207 KiB After Width: | Height: | Size: 209 KiB |
|
Before Width: | Height: | Size: 807 KiB After Width: | Height: | Size: 809 KiB |
|
Before Width: | Height: | Size: 273 KiB After Width: | Height: | Size: 275 KiB |
|
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 173 KiB |
@@ -1,4 +1,4 @@
|
||||
import type { CSSProperties, ReactNode } from 'react'
|
||||
import type { ReactNode } from 'react'
|
||||
import { ShadowButton, shadowButtonClasses } from './ShadowButton'
|
||||
|
||||
export interface NavSectionLink {
|
||||
@@ -25,13 +25,15 @@ export interface NavRowGroup {
|
||||
items: NavItemLink[]
|
||||
}
|
||||
|
||||
const SELECTED = 'bg-paper-deep text-ink shadow-[inset_0_0_0_2px_var(--color-ink)]'
|
||||
const SELECTED = 'bg-paper-deep text-ink'
|
||||
const IDLE = 'text-body hover:bg-paper-deep'
|
||||
|
||||
const LIGHT_PRESS = 'transition-[transform,background-color] duration-150 active:translate-y-[1px]'
|
||||
const LIGHT_PRESS = 'transition-[transform,background-color,border-color] duration-150 active:translate-y-[1px]'
|
||||
|
||||
function RowLabel({ on, href, children }: { on: boolean; href?: string; children: ReactNode }) {
|
||||
const cls = `w-full rounded-lg px-2 py-0.5 text-left text-t3 font-extrabold leading-tight ${LIGHT_PRESS} ${on ? SELECTED : 'text-ink hover:bg-paper-deep'}`
|
||||
const cls = `w-full rounded-lg border-2 px-2 py-0.5 text-left text-t3 font-extrabold leading-tight ${LIGHT_PRESS} ${
|
||||
on ? 'border-ink' : 'border-ink/30 text-ink hover:border-ink'
|
||||
}`
|
||||
if (!href) return <span className={cls}>{children}</span>
|
||||
return (
|
||||
<a href={href} className={`no-underline ${cls}`}>
|
||||
@@ -40,15 +42,6 @@ function RowLabel({ on, href, children }: { on: boolean; href?: string; children
|
||||
)
|
||||
}
|
||||
|
||||
function itemGridStyle(n: number): CSSProperties {
|
||||
const cols = Math.min(n, 6)
|
||||
return {
|
||||
['--cols' as string]: cols,
|
||||
['--cols-sm' as string]: Math.min(n, 2),
|
||||
maxWidth: `min(100%, calc(${cols} * 180px))`,
|
||||
}
|
||||
}
|
||||
|
||||
export function SiteNavbar({
|
||||
brand,
|
||||
rows,
|
||||
@@ -131,15 +124,12 @@ export function SiteNavbar({
|
||||
{rows.map((row) => (
|
||||
<div
|
||||
key={row.sectionKey}
|
||||
className="mt-2 grid grid-cols-[88px_minmax(0,1fr)] items-start gap-x-1.5 border-t border-dashed border-ink/20 pt-2 max-lg:mt-3 max-lg:grid-cols-1 max-lg:items-start"
|
||||
className="mt-2 grid grid-cols-[96px_minmax(0,1fr)] items-start gap-x-1.5 border-t border-dashed border-ink/20 pt-2 max-lg:mt-3 max-lg:grid-cols-1 max-lg:items-start"
|
||||
>
|
||||
<RowLabel on={rowOn(row)} href={row.href}>
|
||||
{row.label}
|
||||
</RowLabel>
|
||||
<div
|
||||
className="grid min-w-0 grid-cols-[repeat(var(--cols,1),minmax(0,1fr))] gap-1.5 max-lg:max-w-none max-lg:grid-cols-[repeat(var(--cols-sm,1),minmax(0,1fr))]"
|
||||
style={itemGridStyle(row.items.length)}
|
||||
>
|
||||
<div className="grid min-w-0 grid-cols-[repeat(6,minmax(0,180px))] gap-1.5 max-lg:grid-cols-2">
|
||||
{row.items.map((item) => {
|
||||
const on = item.key === active
|
||||
return (
|
||||
|
||||