Design system: extend tokens beyond color; consolidate copy-pasted button base styles

未关闭
#206 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
冷清
技术栈
css, typescript
领域
design, frontend

调研方向

Start with the .btn-* rules in styles.css and compare them with the inline button styles in ConfirmDialog.tsx, PushDialog.tsx, NewTaskDialog.tsx, and EditProjectDialog.tsx. The issue also points to src/lib/fontScale.ts and several popover shadow locations; review these alongside the proposed token list to establish scope. Done means button base styles are consolidated and the proposed tokens and font-size routing are applied consistently, with the listed inline duplication removed.

由索引模型根据 Issue 内容生成。

描述

enhancement ux

Problem

The design-token system covers color well (24 CSS vars, 12 presets, validated custom themes) but stops there — spacing, typography, radii, and shadows are raw literals spread across ~1000 inline style= objects, and button base styles are copy-pasted per dialog.

Measured state (adversarially re-counted):

  • ~999 inline style= occurrences in components (SettingsDialog.tsx 162, NewTaskDialog.tsx 65) encoding raw paddings/gaps/radii/font-sizes.
  • 25 distinct font sizes (17 px values + 8 em values); 13px ×101, 12px ×82, 14px ×78, with one-offs like 9/18/21/24/25/30/37px. No scale.
  • src/lib/fontScale.ts sf(px) is an identity stub used in 24 files, while 58 other files write raw 'font-size': '13px' — if sf() ever becomes a real scaler, most of the app won't scale.
  • 11 distinct border-radius values; 12 distinct gap values; 16 box-shadow literals in styles.css + 9 inline — including four different "floating popover" shadows for one concept (Dialog.tsx:121, CommitTreeOverlay.tsx:127, BranchCombobox.tsx:234, TaskAITerminal.tsx:433), despite --shadow-soft/--shadow-pop existing.

Button split-brain (the single most fragile pattern): .btn-primary/.btn-secondary/.btn-danger in styles.css define hover/active/focus states only (:1088-1139); the resting appearance (padding: '9px 20px', accent bg, radius 8px, 14px/500) is duplicated inline in ConfirmDialog.tsx:80-110, PushDialog.tsx:151-177, NewTaskDialog.tsx:~1393, EditProjectDialog.tsx:537,553 — with drift already visible (9px 18px vs 9px 20px). A padding change is an 8-file edit; any missed file silently forks the design. ConfirmDialog.tsx:102 also hardcodes '#fff' for danger text (should be a token).

Related: #160 (duplication audit) — this is the design-system slice of the same theme.

Proposed fix

  • Move button base styles into the existing .btn-* classes (they're already applied everywhere) and delete the inline copies — zero-risk, high-value first step.
  • Add a second token tier: --space-1..6 (2/4/8/12/16/24), --radius-sm/md/lg/full, --text-2xs..xl (10/11/12/13/14/17), --shadow-overlay. Consume incrementally from inline styles via var() or shared constants — no need to abandon inline styles wholesale.
  • Route font sizes through sf() (or the tokens) consistently so a future scale/OS-font-size feature is possible.

From a full design/UX audit (2026-07-07); adversarially verified, counts re-derived. Line numbers as of b342bbd (v1.12.0).

主要语言
TypeScript
星标
1k
派生
144
平均合并
4 天 19 小时
30 天内合并 PR
28

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

johannesjo/parallel-code 的其他 Issue

查看 johannesjo/parallel-code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。