Skip to content

feat: chart, recharts in WinLab colors - #68

Merged
zyx1121 merged 1 commit into
mainfrom
feat/chart
Oct 9, 2026
Merged

zyx1121 merged 1 commit into
mainfrom
feat/chart

Conversation

@zyx1121

@zyx1121 zyx1121 commented Oct 9, 2026

Copy link
Copy Markdown
Member

Adds chart (modelled on shadcn's chart, rewritten for this design system), needed by the portal's reimburse stats page.

  • ChartConfig maps each series to a label and one of primary, muted-foreground, success, destructive, warning; the container writes them as --color-<key>.
  • ChartTooltipContent is inverted (foreground on background) like tooltip, text-body only; formatLabel and formatValue for units.
  • ChartLegendContent lists series in config order with an SVG swatch.
  • Axis ticks in muted-foreground, grid and cursor in border/muted.
  • DESIGN.md: a paragraph under Color on drawing charts with chart.
  • Docs page /chart with a monthly income/expense bar demo.

Verified on the sandbox: typecheck, lint, tokens:check, theme:check, format and build pass; public/r/chart.json is generated; the demo renders 10 bars, the legend reads 收入 then 支出, and hovering 7 月 shows 收入 NT$ 15,000 / 支出 NT$ 11,800.

🤖 Generated with Claude Code

A chart config takes only primary, muted-foreground or a state color, so
charts cannot drift from DESIGN.md's color table. The tooltip is inverted
like every WinLab tooltip, the legend follows the config order, axes and
grid recede in muted ink.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zyx1121
zyx1121 merged commit 136e50b into main Oct 9, 2026
2 checks passed
@zyx1121
zyx1121 deleted the feat/chart branch October 9, 2026 16:22
zyx1121 added a commit to zyx1121/www.zyx.tw that referenced this pull request Oct 10, 2026
…t legend (#111)

Ports three ui.winlab.tw fixes the zyx registry had not picked up:

- checkbox keeps its check mounted and fades it with the fill, and a select
  menu over its trigger now fades both ways; DESIGN.md says every animation
  runs the same way in and out (NYCU-WinLab/ui#30)
- a combobox menu is at least as wide as its trigger and keeps the
  popover's width, so a short trigger no longer truncates the options
  (NYCU-WinLab/ui#67)
- chart gains ChartLegend and ChartLegendContent in the config's order, and
  DESIGN.md adds the drawing rules: 4px bar ends, 2px lines, horizontal
  grid, a legend for two series (NYCU-WinLab/ui#68)

Also fixes the button comment that still said WinLab apps.


Claude-Session: https://claude.ai/code/session_01DNMgVpzJEQhK39qSpfRJvU

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant