-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
// SPDX-FileCopyrightText: 2024 Shota FUJI <pockawoooh@gmail.com>
// SPDX-License-Identifier: AGPL-3.0-only
import { ExclamationTriangleIcon } from "@radix-ui/react-icons";
import { Callout, Flex, Text } from "@radix-ui/themes";
import { type FC, type ReactNode } from "react";
export interface ErrorCalloutProps {
className?: string | undefined;
severity?: "danger" | "warning";
title: ReactNode;
children?: ReactNode;
actions?: ReactNode;
}
export const ErrorCallout: FC<ErrorCalloutProps> = ({
className,
severity = "danger",
title,
children,
actions,
}) => {
return (
<Callout.Root className={className} color={severity === "danger" ? "red" : "amber"}>
<Callout.Icon>
<ExclamationTriangleIcon />
</Callout.Icon>
<Flex asChild direction="column" gap="3" width="100%">
<Callout.Text>
<Flex as="span" direction="column" gap="1">
<Text weight="bold">{title}</Text>
{children && <Text>{children}</Text>}
</Flex>
{actions && (
<Flex as="span" justify="start" gap="2">
{actions}
</Flex>
)}
</Callout.Text>
</Flex>
</Callout.Root>
);
};