Files
dh-inspeccion-v2/web-v2/src/components/Feedback.tsx
T

18 lines
698 B
TypeScript

import { ApiError } from '../lib/api';
export function errorMessage(error: unknown) {
return error instanceof ApiError ? error.message : 'No se pudo completar la operación';
}
export function LoadingBlock({ label = 'Cargando…' }: { label?: string }) {
return <div className="loading-block"><span className="spinner" />{label}</div>;
}
export function EmptyState({ title, text }: { title: string; text: string }) {
return <div className="empty-state"><strong>{title}</strong><p>{text}</p></div>;
}
export function Alert({ type = 'error', children }: { type?: 'error' | 'success' | 'info'; children: React.ReactNode }) {
return <div className={`alert-box ${type}`}>{children}</div>;
}