feat(design): add IMS Admin primitives (Button, StatusTag, Checkbox, FilterChip, Segmented, Avatar, Drawer) and restyle Field, Card, Modal

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 09:28:34 +08:00
co-authored by Claude Haiku 4.5
parent 01343d732e
commit 2a5b9332c7
15 changed files with 417 additions and 248 deletions
+20 -9
View File
@@ -1,25 +1,36 @@
import type { ButtonHTMLAttributes } from 'react'
import { cx } from './cx'
type Variant = 'primary' | 'secondary' | 'ghost' | 'icon'
type Variant = 'primary' | 'secondary' | '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 ' +
'inline-flex items-center justify-center gap-1.5 whitespace-nowrap transition-colors cursor-pointer ' +
'disabled:opacity-45 disabled:cursor-not-allowed'
const VARIANTS: Record<Variant, string> = {
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',
primary: 'h-8 px-3 rounded-md bg-ink-2 text-white text-[13px] font-semibold shadow-primary hover:bg-ink active:bg-black',
secondary: 'h-8 px-3 rounded-md bg-surface text-ink text-[13px] font-medium shadow-secondary hover:bg-surface-2 active:bg-rule',
icon: 'w-7 h-7 rounded-md text-ink-3 hover:bg-rule',
}
type Props = ButtonHTMLAttributes<HTMLButtonElement> & {
variant?: Variant
block?: boolean
mobile?: boolean
}
export function Button({ variant = 'primary', block = false, className, type = 'button', ...rest }: Props) {
return <button type={type} className={cx(BASE, VARIANTS[variant], block && 'w-full', className)} {...rest} />
export function Button({ variant = 'primary', block = false, mobile = false, className, type = 'button', ...rest }: Props) {
return (
<button
type={type}
className={cx(
BASE,
VARIANTS[variant],
mobile && variant !== 'icon' && 'h-12 rounded-xl text-sm',
block && 'w-full',
className,
)}
{...rest}
/>
)
}