UNPKG

@baseplate-dev/ui-components

Version:

Shared UI component library

16 lines 1.1 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import React from 'react'; import { MdOutlineErrorOutline } from 'react-icons/md'; import { useComponentStrings } from '#src/contexts/component-strings.js'; import { cn } from '#src/utils/cn.js'; /** * Displays a generic error state with a header and error message. */ function ErrorDisplay({ className, header, error, actions, }) { const strings = useComponentStrings(); return (_jsx("div", { className: cn('flex h-full w-full items-center justify-center', className), role: "alert", children: _jsxs("div", { className: "flex max-w-xl flex-col items-center space-y-4 text-center", children: [_jsx("div", { children: _jsx(MdOutlineErrorOutline, { className: "size-20 text-muted-foreground" }) }), _jsx("h1", { children: header ?? strings.errorDisplayDefaultHeader }), _jsx("p", { children: typeof error === 'string' || React.isValidElement(error) ? error : strings.errorDisplayDefaultContent }), actions] }) })); } export { ErrorDisplay }; //# sourceMappingURL=error-display.js.map