Repository navigation
nav classic 卡片改「固定方砖 + 间距调个数 + 整行居中」(#34 后续修正) - #49
Merged
Merged
Conversation
classic 不再用 grid-cols-* 1fr 网格(列数设小时砖被拉成宽矩形),改成 141.5px 固定方砖 + flex 换行逐行居中:columns 退化为每行上限,多余宽度先进 砖间距(12→48px)再进行组两侧留白。普通模式与编辑模式同源,后端零改动。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
grid-cols-*+ 1fr 网格」改为固定 141.5px 方砖 + 弹性换行 + 逐行居中,修掉「列数设小 → 卡片被横向拉成大宽矩形」。columns语义改为「每行卡片上限」:实际放几块由屏宽与砖间距决定,多余宽度先进砖间距(12 → 48px),再多才进整行两侧留白。Changes
web/src/lib/grid-columns.ts— 新增CLASSIC_TILE_SIZE = 141.5(现默认 8 列在 1216px 内容宽下的实际砖宽)、CLASSIC_MIN_GAP = 12、CLASSIC_MAX_GAP = 48,以及classicGridMetrics():按每行上限算出maxWidth = n×141.5 + (n−1)×48与columnGap = clamp(12px, calc((100% − n×141.5px)/(n−1)), 48px)(n = 1固定 12px,避开除零);resolveColumns/DEFAULT_COLUMNS行为不变,只更新口径注释。web/src/components/link-grid.tsx— 删除 12 行静态列数阶梯表;classic 容器换成mx-auto flex w-full flex-wrap justify-center+ 内联maxWidth/columnGap;linkGridClassName换成linkGridLayout()返回{ className, style };砖壳改size-[141.5px] shrink-0、内距py-4 → py-3+justify-center(两行名称 + 网址共 140px 正好装下);容器加data-link-grid便于测试与实测定位。web/src/components/home-edit-board.tsx— 编辑看板复用同一出口;PLACEHOLDER_CLASS去掉 classic 的高度估值,砖与末尾「+」砖同为 141.5 方砖;classic 不再补w-full min-w-0(与固定宽冲突)。SortableContext/rectSortingStrategy/closestCorners与投放 id 全部未改。web/src/components/admin/settings-panels.tsx— 字段标签改为「每行卡片上限(1–12)」并补一行说明;值域 1–12、存储与提交路径不变。web/src/components/public-page.tsx— 仅更新注释口径,逻辑未动。grid-columns.test.ts覆盖classicGridMetrics(8/4/1 与脏值);link-grid.test.tsx改写为 flex 容器 +maxWidth+ 方砖尺寸(并与常量交叉断言防漂移);public-page.test.tsx、public-edit-mode.test.tsx改为「普通/编辑同源maxWidth」;settings-panels.test.tsx跟随标签改名。Testing
pnpm lint(0 error,33 条 warning 均为既有ui/组件)、pnpm format:check、pnpm typecheck、pnpm test(worker 214 + web 343 = 557)、pnpm build;CI 通过。构建会改写web/public/icon-index.json,已还原,未混入提交。141.5×141.5,columns=4 与 8 逐个相同;scrollWidth = innerWidth,无横向溢出;columns=12在 1440 自然放 8 块/行(上限语义)。