"use client" import React from 'react' import { AlertTriangle, RefreshCw, Home } from 'lucide-react' import { Button } from './button' import { cn } from '../../utils/cn' interface ErrorStateProps { title?: string message: string variant?: 'error' | 'warning' | 'info' showIcon?: boolean showRetry?: boolean showHome?: boolean onRetry?: () => void onHome?: () => void className?: string containerClassName?: string } export function ErrorState({ title = 'Error', message, variant = 'error', showIcon = true, showRetry = false, showHome = false, onRetry, onHome, className, containerClassName }: ErrorStateProps) { const getVariantStyles = () => { switch (variant) { case 'error': return { // -secondary tokens, NOT `/20` alpha modifiers: the ods colors are // hex CSS vars, and Tailwind 3.x can't inject alpha into those — // the modifier silently produced no background at all. bg: 'bg-ods-error-secondary', border: 'border-ods-error', text: 'text-ods-error', icon: 'text-ods-error' } case 'warning': return { bg: 'bg-ods-warning-secondary', border: 'border-ods-warning', text: 'text-ods-warning', icon: 'text-ods-warning' } case 'info': return { bg: 'bg-ods-bg-surface', border: 'border-ods-border', text: 'text-ods-text-secondary', icon: 'text-ods-text-secondary' } } } const styles = getVariantStyles() return (
{message}
{(showRetry || showHome) && (