mirror of
https://github.com/luxfi/design.git
synced 2026-10-30 16:58:57 +00:00
Swapping the forked token layer for the inherited one silently orphaned two names. The fork declared --border-hairline (a solid #262626) and --border-card; the substrate draws every one of those boundaries with a single alpha --border, and explains at length why alpha beats a solid hex there — a solid edge reads on the page and vanishes the moment it lands on a lifted surface. Nineteen shipped files still asked for the old names: Card, Avatar, Badge, Table, Accordion, Dialog, DropdownMenu, Sheet, Toaster, seven specimen cards, and the generation prompts. An undefined custom property in `border:1px solid var(--gone)` does not fail. The declaration is invalid at computed-value time, border-color falls back to currentColor, and every one of those surfaces draws its edge in the INK colour — a stark near-white hairline on black that reads as a bold design choice rather than as nineteen broken files. They are not re-declared as aliases. Both mapped to the substrate's --border, so keeping them would be two names for one thing — exactly the duplication this package exists to remove. The components now speak the substrate's vocabulary. check-tokens gains the check that would have caught it. Check 4 proves the STYLESHEET is internally consistent and says nothing about the components, kits, specimen cards and prompts shipped beside it — which are the files a consumer actually renders. Now every var() in all 78 of them must resolve against the sheet. Mutation-proven: pointing one card back at --border-hairline fails the build. Co-authored-by: Hanzo Dev <[email protected]>
48 lines
2.3 KiB
React
48 lines
2.3 KiB
React
import React from 'react'
|
|
|
|
/** Rank is carried by opacity, never by hue (DESIGN.md §2.3). */
|
|
const V = {
|
|
default:{background:'var(--white-10)',color:'var(--text-primary)',border:'1px solid var(--border)'},
|
|
secondary:{background:'var(--secondary)',color:'var(--secondary-foreground)',border:'1px solid transparent'},
|
|
outline:{background:'transparent',color:'var(--text-secondary)',border:'1px solid var(--border)'},
|
|
tier1:{background:'var(--white-05)',color:'var(--text-tertiary)',border:'1px solid var(--border)'},
|
|
tier2:{background:'var(--white-15)',color:'var(--text-secondary)',border:'1px solid var(--border)'},
|
|
tier3:{background:'var(--white-20)',color:'var(--text-primary)',border:'1px solid var(--white-20)'},
|
|
error:{background:'var(--state-error-bg)',color:'var(--state-error-text)',border:'1px solid transparent'},
|
|
}
|
|
|
|
export function Badge({ variant = 'default', pill = true, style, children, ...rest }) {
|
|
return (
|
|
<span
|
|
style={{
|
|
display:'inline-flex',alignItems:'center',gap:6,
|
|
padding:'3px 10px',fontSize:'var(--text-xs)',lineHeight:1.35,
|
|
fontFamily:'var(--font-sans)',fontWeight:'var(--weight-medium)',whiteSpace:'nowrap',
|
|
borderRadius: pill ? 'var(--radius-full)' : 'var(--radius-sm)',
|
|
...(V[variant] || V.default), ...style,
|
|
}}
|
|
{...rest}
|
|
>
|
|
{children}
|
|
</span>
|
|
)
|
|
}
|
|
|
|
/** The eyebrow pill above a hero headline. */
|
|
export function EyebrowBadge({ children, style, ...rest }) {
|
|
return (
|
|
<span style={{display:'inline-flex',alignItems:'center',gap:8,padding:'8px 16px',borderRadius:'var(--radius-full)',border:'1px solid var(--border)',background:'var(--white-05)',fontSize:'var(--text-sm)',color:'var(--neutral-200)',...style}} {...rest}>{children}</span>
|
|
)
|
|
}
|
|
|
|
/** Live-status dot + label. The green is one of the few permitted hues. */
|
|
export function StatusBadge({ status = 'online', label, style }) {
|
|
const dot = status === 'online' ? 'var(--state-online)' : status === 'error' ? 'var(--state-error)' : 'var(--neutral-500)'
|
|
return (
|
|
<span style={{display:'inline-flex',alignItems:'center',gap:8,fontSize:'var(--text-sm)',color:'var(--text-secondary)',...style}}>
|
|
<span style={{width:8,height:8,borderRadius:'var(--radius-full)',background:dot,animation: status==='online' ? 'lux-pulse-dot 2s var(--ease-in-out) infinite' : 'none'}} />
|
|
{label || status}
|
|
</span>
|
|
)
|
|
}
|