chore: 堆叠链收尾——navbar grid 与 colors 卡片化进 main #13

Merged
arnold.cui merged 5 commits from feat/navbar-grid into main 2026-10-28 05:54:37 +00:00
9 changed files with 42 additions and 42 deletions

No files matched your search

+6
View File
@@ -7,6 +7,12 @@ on:
env:
YARN_NPM_REGISTRY_SERVER: https://registry.npmmirror.com
concurrency:
# 同一分支/PR 只保留最新 run:新 run 触发即取消在跑的旧 run、排队中的旧 run 直接丢弃。
# runner 侧 capacity=1 只能串行排队、撤不了单;高频 push 时靠这层砍掉过时任务
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
name: check
+4 -2
View File
@@ -8,14 +8,16 @@ ENV YARN_NPM_REGISTRY_SERVER=https://registry.npmmirror.com
WORKDIR /workspace
# ① 依赖配置——只拷贝清单/锁文件/yarn 运行时,源码变更不失效依赖层
# 五个 workspace 清单缺一不可:--immutable 会校验锁文件与 workspace 树一致,
# tutorial 的 workspace:* 依赖(playground/site-kit)与 examples/* 缺任一即 Workspace not found
# 七个 workspace 清单缺一不可:--immutable 会校验锁文件与 workspace 树一致,
# workspace 成员(packages/stack 的 @idealjs/stack、examples/stack-demo 等)缺任一即 Workspace not found
COPY .yarnrc.yml package.json yarn.lock ./
COPY .yarn/releases/yarn-4.9.2.cjs .yarn/releases/
COPY apps/tutorial/package.json apps/tutorial/
COPY apps/web-runner/package.json apps/web-runner/
COPY packages/stack/package.json packages/stack/
COPY packages/stack-idealjs/package.json packages/stack-idealjs/
COPY packages/site-kit/package.json packages/site-kit/
COPY examples/stack-demo/package.json examples/stack-demo/
COPY examples/template/package.json examples/template/
# ② 安装依赖——yarn 4.9.2 由 yarnPath(.yarn/releases)提供,node 直调脚本,不依赖 corepack/全局 yarn
Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 KiB

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 807 KiB

After

Width:  |  Height:  |  Size: 809 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 273 KiB

After

Width:  |  Height:  |  Size: 275 KiB

Binary file not shown.

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,16 @@ 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 +43,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 +125,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 (
+23 -22
View File
@@ -36,7 +36,7 @@ function Chip({ c, n, h }: { c: string; n: string; h: string }) {
const RULES = [
{
name: '相邻必撞色(跨对取色)',
why: '孟菲斯的鲜艳靠碰撞成立:两个高饱和色块相邻时,只有色相拉开距离,视觉才读得出「两个声音」。同色相邻只是一个声音变大——画面发平发闷,鲜艳互相抵消;跨对取色(coral 挨 teal、mustard 挨 violet)反而把彼此衬得更亮。拿到相邻色块时问一句「它俩是不是同一对」,是,就换掉一个。',
note: '鲜艳靠碰撞成立;同色相邻=一个声音,发平发闷;相邻必跨对取色(coral 挨 teal、mustard 挨 violet),色相拉开才互相衬亮',
badCap: '同色相邻失去碰撞',
goodCap: '相邻必撞色(跨对取色)',
badDemo: (
@@ -54,7 +54,7 @@ const RULES = [
},
{
name: '黑描边收束鲜艳',
why: '高饱和色放在浅纸上会「振动」:边缘发虚、像悬浮在页面上。2px ink 描边给每块鲜艳一道明确的边界,把颜色关进形状里——这也是拟物卡世界的基础:卡片、形状、站点共用同一粗细的墨线,颜色再艳也是「零件」而不是「光」,缩放与低分屏上轮廓依然清晰。去掉描边,鲜艳就是没裁过的布料。',
note: '高饱和色在浅纸上会振动(边缘发虚、似悬浮);2px ink 描边把颜色关进形状;全站同一粗细墨线,再艳也是零件不是光,低分屏轮廓清晰',
badCap: '无描边的鲜艳漂浮刺眼',
goodCap: '一切鲜艳以 2px ink 描边为界',
badDemo: <div className="h-10 w-40 rounded-lg bg-clash2a" />,
@@ -62,7 +62,7 @@ const RULES = [
},
{
name: '大底纸色,鲜艳只进局部',
why: '鲜艳是注意力,铺满屏幕等于没有注意力。大底永远是 paper,鲜艳只进相框、站点、散落形状这些局部(≤10%/屏),视线才有落点、正文才永远可读;大底一旦鲜艳,字被淹没,卡片也失去「纸上的物」的载体感。记住层级:大底是世界,卡片是物,鲜艳是物上的标记。',
note: '鲜艳=注意力,铺满=没有;大底恒 paper,鲜艳只进相框/站点/散落形状(≤10%/屏);层级:大底是世界、卡片是物、鲜艳是标记',
badCap: '大底鲜艳,字被淹没',
goodCap: '大底纸色,鲜艳只进局部',
badDemo: (
@@ -88,14 +88,14 @@ function DoDont({
text: string
}) {
return (
<div className="flex flex-1 items-center gap-3">
<div className="flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1.5 max-md:pb-1 md:flex-nowrap md:py-4 md:pl-4 md:pr-5">
<span
className={`flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 border-ink text-[11px] font-extrabold ${bad ? 'bg-clash1a text-paper' : 'bg-clash1b'}`}
>
{bad ? '✗' : '✓'}
</span>
{children}
<p className="m-0 flex-1 text-small leading-snug text-body">{text}</p>
<p className="m-0 flex-1 basis-[160px] text-small leading-snug text-body">{text}</p>
</div>
)
}
@@ -135,25 +135,26 @@ export function App() {
))}
</div>
</Section>
<Section label="规则与反例" note="先讲为什么这样设计,再看 ✗/✓ 对照">
<div className="space-y-5">
<Section label="规则与反例" note="三条硬规则,✗/✓ 对照即规范">
<div className="grid gap-4">
{RULES.map((r, i) => (
<div key={r.name}>
<div className="flex items-baseline gap-2">
<span className="flex h-[18px] w-[18px] shrink-0 translate-y-[2px] items-center justify-center rounded-full border-2 border-ink bg-ink text-[10px] font-extrabold text-paper">
{i + 1}
</span>
<b className="text-[13px]">{r.name}</b>
</div>
<p className="m-0 mt-1.5 mb-2 max-w-[760px] text-content leading-relaxed text-body">
{r.why}
</p>
<div className="grid grid-cols-2 gap-3">
<DoDont bad text={r.badCap}>
{r.badDemo}
</DoDont>
<DoDont text={r.goodCap}>{r.goodDemo}</DoDont>
<div
key={r.name}
className="grid gap-y-3 rounded-xl border-2 border-ink bg-paper p-4 md:grid-cols-[minmax(0,280px)_minmax(0,1fr)_minmax(0,1fr)] md:gap-y-0 md:divide-x-2 md:divide-ink/15 md:p-0"
>
<div className="grid content-start gap-1.5 md:py-4 md:pr-4 md:pl-5">
<div className="flex items-center gap-2">
<span className="flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-full border-2 border-ink bg-ink text-[10px] font-extrabold text-paper">
{i + 1}
</span>
<b className="text-[13px]">{r.name}</b>
</div>
<i className="t-small-mute not-italic">{r.note}</i>
</div>
<DoDont bad text={r.badCap}>
{r.badDemo}
</DoDont>
<DoDont text={r.goodCap}>{r.goodDemo}</DoDont>
</div>
))}
</div>