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 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, className, 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; } export function Statistic({value, label, color}: 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; className?: string; } export function Card({media, title, meta, children, onClick, 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};