mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-17 06:19:41 +02:00
FormattedError
This commit is contained in:
23
packages/ui/src/components/FormattedError.tsx
Normal file
23
packages/ui/src/components/FormattedError.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import classNames from 'classnames';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
interface Props {
|
||||
children: ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function FormattedError({ children, className }: Props) {
|
||||
return (
|
||||
<pre
|
||||
className={classNames(
|
||||
className,
|
||||
'cursor-text select-auto',
|
||||
'[&_*]:cursor-text [&_*]:select-auto',
|
||||
'font-mono text-sm w-full bg-surface-highlight p-3 rounded',
|
||||
'whitespace-pre-wrap border border-danger border-dashed overflow-x-auto',
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</pre>
|
||||
);
|
||||
}
|
||||
@@ -9,6 +9,7 @@ export type { IconProps } from './components/Icon';
|
||||
export { Icon } from './components/Icon';
|
||||
export type { IconButtonProps } from './components/IconButton';
|
||||
export { IconButton } from './components/IconButton';
|
||||
export { FormattedError } from './components/FormattedError';
|
||||
export { InlineCode } from './components/InlineCode';
|
||||
export { LoadingIcon } from './components/LoadingIcon';
|
||||
export { Overlay } from './components/Overlay';
|
||||
|
||||
Reference in New Issue
Block a user