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]>
47 lines
2.0 KiB
React
47 lines
2.0 KiB
React
import React from 'react'
|
|
|
|
const FILL = {
|
|
default:'var(--surface-card)',
|
|
emphasis:'var(--surface-card-emphasis)',
|
|
quiet:'var(--surface-card-quiet)',
|
|
plain:'transparent',
|
|
}
|
|
|
|
export function Card({ variant = 'default', sheen = false, interactive = false, style, children, ...rest }) {
|
|
const [hover, setHover] = React.useState(false)
|
|
return (
|
|
<div
|
|
onMouseEnter={interactive ? () => setHover(true) : undefined}
|
|
onMouseLeave={interactive ? () => setHover(false) : undefined}
|
|
style={{
|
|
position:'relative',overflow:'hidden',
|
|
borderRadius:'var(--radius-lg)',
|
|
border:'1px solid ' + (hover ? 'var(--border-strong)' : 'var(--border)'),
|
|
background:FILL[variant] || FILL.default,
|
|
transition:'border-color var(--duration-fast) var(--ease-out)',
|
|
...style,
|
|
}}
|
|
{...rest}
|
|
>
|
|
{sheen && <div aria-hidden style={{position:'absolute',inset:0,pointerEvents:'none',background:'var(--sheen-card)',opacity:0.7}} />}
|
|
{children}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export function CardHeader({ style, children, ...rest }) {
|
|
return <div style={{position:'relative',padding:'24px 24px 0',display:'flex',flexDirection:'column',gap:6,...style}} {...rest}>{children}</div>
|
|
}
|
|
export function CardTitle({ style, children, ...rest }) {
|
|
return <h3 style={{fontSize:'var(--text-base)',fontWeight:'var(--weight-semibold)',color:'var(--text-primary)',...style}} {...rest}>{children}</h3>
|
|
}
|
|
export function CardDescription({ style, children, ...rest }) {
|
|
return <p style={{fontSize:'var(--text-sm)',lineHeight:'var(--leading-relaxed)',color:'var(--text-helper)',...style}} {...rest}>{children}</p>
|
|
}
|
|
export function CardContent({ style, children, ...rest }) {
|
|
return <div style={{position:'relative',padding:24,...style}} {...rest}>{children}</div>
|
|
}
|
|
export function CardFooter({ style, children, ...rest }) {
|
|
return <div style={{position:'relative',padding:'0 24px 24px',display:'flex',alignItems:'center',gap:12,...style}} {...rest}>{children}</div>
|
|
}
|