From 4411ed54b5d364c40cb878408db805247a6a989c Mon Sep 17 00:00:00 2001 From: weeihan Date: Wed, 30 Sep 2026 19:04:05 +0800 Subject: [PATCH] feat(design): add Modernist UI primitives (Button, Tag, StatusTag, Field, Card, table styles) Co-Authored-By: Claude Haiku 4.5 --- components/ui/button.tsx | 25 ++++ components/ui/card.tsx | 22 +++ components/ui/cx.ts | 2 + components/ui/field.tsx | 30 ++++ components/ui/status-tag.tsx | 72 ++++++++++ components/ui/table-styles.ts | 5 + components/ui/tag.tsx | 24 ++++ ...6-09-30-modernist-design-system-restyle.md | 22 +-- tests/components/ui/primitives.test.tsx | 132 ++++++++++++++++++ 9 files changed, 318 insertions(+), 16 deletions(-) create mode 100644 components/ui/button.tsx create mode 100644 components/ui/card.tsx create mode 100644 components/ui/cx.ts create mode 100644 components/ui/field.tsx create mode 100644 components/ui/status-tag.tsx create mode 100644 components/ui/table-styles.ts create mode 100644 components/ui/tag.tsx create mode 100644 tests/components/ui/primitives.test.tsx diff --git a/components/ui/button.tsx b/components/ui/button.tsx new file mode 100644 index 0000000..0947a2b --- /dev/null +++ b/components/ui/button.tsx @@ -0,0 +1,25 @@ +import type { ButtonHTMLAttributes } from 'react' +import { cx } from './cx' + +type Variant = 'primary' | 'secondary' | 'ghost' | 'icon' + +const BASE = + 'inline-flex items-center gap-1.5 text-left font-extrabold text-sm leading-tight ' + + 'border border-transparent cursor-pointer transition-colors ' + + 'disabled:opacity-45 disabled:cursor-not-allowed' + +const VARIANTS: Record = { + primary: 'justify-start bg-accent text-ground px-3.5 py-2 hover:bg-accent-600 active:bg-accent-700', + secondary: 'justify-start border-divider text-ink px-3.5 py-2 hover:bg-ink/7 active:bg-ink/15', + ghost: 'justify-start text-accent-700 px-1 py-2 hover:bg-accent/10 active:bg-accent/20', + icon: 'justify-center w-9 h-9 p-0 text-ink hover:bg-ink/7 active:bg-ink/15', +} + +type Props = ButtonHTMLAttributes & { + variant?: Variant + block?: boolean +} + +export function Button({ variant = 'primary', block = false, className, type = 'button', ...rest }: Props) { + return