UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

65 lines (64 loc) 2.18 kB
/** * Web GlobalError Component * */ import type { HTMLProps, ReactNode } from 'react'; import type { GetTranslationProps } from '../../shared/Context'; import type { SkeletonShow } from '../skeleton/Skeleton'; import type { SpacingProps } from '../../shared/types'; export type GlobalErrorLink = { text: string; url: string; }; export type GlobalErrorProps = { /** * Defines a status code as a string. When `404` or `500` is given, predefined `text` and `title` will be shown. Defaults to `404`. */ statusCode?: '404' | '500' | string; /** * Overwrites the default title for the provided `statusCode`. */ title?: ReactNode; /** * Overwrites the default text for the provided `statusCode`. */ text?: ReactNode; /** * Overwrites the default error message code text `Feilmeldings-kode: %statusCode`. */ errorMessageCode?: ReactNode; /** * Overwrites the default additional help text `Her er noen lenker som kanskje kan hjelpe:`. This text is only rendered when `links` are provided. */ help?: ReactNode; /** * Provide an array with objects `{ text: "Text", url: "https://..." }` to display a list of anchor links. */ links?: Array<GlobalErrorLink>; /** * If `true`, it will use `80vh` as the height and center its content. */ center?: boolean; /** * If set to `true`, an overlaying skeleton with animation will be shown. */ skeleton?: SkeletonShow; }; export type GlobalErrorAllProps = GlobalErrorProps & Omit<HTMLProps<HTMLElement>, 'ref'> & SpacingProps & GetTranslationProps; export type GlobalErrorTranslationContent = { /** * Overwrites the default title for the provided `statusCode`. */ title?: ReactNode; /** * Overwrites the default text for the provided `statusCode`. */ text?: ReactNode; }; export type GlobalErrorTranslation = { 404?: GlobalErrorTranslationContent; 500?: GlobalErrorTranslationContent; errorMessageCode?: ReactNode; help?: ReactNode; }; export default function GlobalError(localProps: GlobalErrorAllProps): import("react/jsx-runtime").JSX.Element;