import React from 'react'; import {Card as MCard, Tabs as MTabs, Accordion as MAccordion, Breadcrumbs} from '@mantine/core'; import {Icon} from './Icon'; /* * Surfaces and structure: headers, panels, cards, statistics, tabs, accordions, * breadcrumbs. Elevation is expressed with borders and background steps — * never a shadow (shadows are zeroed in the Mantine bridge). */ // ------------------------------------------------------------------- Headers export type HeaderLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5'; export interface HeaderProps extends Omit, 'color'> { /** Heading level. Also the visual size — pick it for the outline, not the look. */ as?: HeaderLevel; /** Semantic icon name or a Tabler component, shown before the text. */ icon?: string | React.ComponentType; /** Secondary line below, in muted text. */ subheader?: React.ReactNode; /** Hairline rule underneath, separating the section from what follows. */ dividing?: boolean; /** * A token colour name (`green`, `red`, ...) for a heading that carries meaning — * "3 items to add" against "2 items to remove". Call sites kept reaching for an * inline style to do this, which is how a hex ends up in the markup. */ color?: string; } /** * A section heading. Named and shaped like Semantic's Header (`as`, `icon`, * `subheader`, `dividing`) so the app's 47 call sites migrate by import. * * Sizes come from ui.css, keyed on the level, rather than each call site * choosing — that is what keeps the type scale a scale. */ export function Header({ as = 'h3', icon, subheader, dividing, color, className, style, children, ...props }: HeaderProps) { const Tag = as; return
{icon && (typeof icon === 'string' ? : )} {children} {subheader &&
{subheader}
}
} // -------------------------------------------------------------------- Panels export interface PanelProps extends React.HTMLAttributes { /** A danger zone: dashed red border, for destructive groupings. */ danger?: boolean; } /** A bordered surface. Replaces Semantic's Segment. */ export function Panel({danger, className, children, ...props}: PanelProps) { return
{children}
} // ---------------------------------------------------------------- Statistics export interface StatisticProps { value: React.ReactNode; label: React.ReactNode; color?: string; className?: string; style?: React.CSSProperties; } export function Statistic({value, label, color, className, style}: StatisticProps) { return
{value}
{label}
} /** A row of statistics separated by hairlines, sharing one outer border. */ export function StatisticGroup({children}: {children: React.ReactNode}) { const items = React.Children.toArray(children); return
{items.map((child, index) =>
{child}
)}
} // --------------------------------------------------------------------- Cards export interface CardProps { /** Image or poster area above the body. */ media?: React.ReactNode; title?: React.ReactNode; meta?: React.ReactNode; children?: React.ReactNode; onClick?: React.MouseEventHandler; /** * A token colour name, drawn as an accent along the card's top edge. File cards use * it to carry the mimetype's colour, so a grid of results is scannable by kind before * any text is read. It remaps per theme, so night gets a red accent rather than a * dozen hues. */ color?: string; className?: string; } export function Card({media, title, meta, children, onClick, color, className}: CardProps) { return {media &&
{media}
}
{title &&
{title}
} {children} {meta &&
{meta}
}
} export function CardGroup({children, minWidth = 200}: {children: React.ReactNode; minWidth?: number}) { return
{children}
} export {MTabs as Tabs, MAccordion as Accordion, Breadcrumbs};