/** * DTFeatureLegend — Grid of product feature icons with rotated labels. * * CSS reference: feature-legend.css .dt-feature-legend, .dt-feature-legend-header, * .dt-feature-legend-grid, .dt-feature-legend-item, .dt-feature-supported, etc. */ import type { ReactNode, CSSProperties } from 'react'; import type { DTVariant } from '@dangerousthings/tokens'; import { cx } from '../utils/cx'; import { getVariantClass, featureStateToVariant } from '../utils/variantClasses'; export interface DTFeatureItem { key: string; name: string; icon: ReactNode; state: 'supported' | 'disabled' | 'unsupported'; } const stateClassMap: Record = { supported: 'dt-feature-supported', disabled: 'dt-feature-disabled', unsupported: 'dt-feature-unsupported', }; interface DTFeatureLegendProps { features: DTFeatureItem[]; title?: string; /** Header variant @default 'normal' */ variant?: DTVariant; /** Grid columns @default 5 */ columns?: number; /** Icon size in px @default 42 */ iconSize?: number; className?: string; style?: CSSProperties; } export function DTFeatureLegend({ features, title, variant = 'normal', columns = 5, iconSize = 42, className, style, }: DTFeatureLegendProps) { // Suppress unused import warning — featureStateToVariant is available for consumers void featureStateToVariant; return (
{title && (
{title}
)}
{features.map(feature => (
{feature.icon}
{feature.name}
))}
); }