mirror of
https://github.com/Xevion/rdap.git
synced 2025-12-07 07:16:04 -06:00
Major restructuring to improve codebase organization: - Moved test files to src/__tests__/ directory - Reorganized UI components from src/components/common to src/components/ui - Consolidated RDAP-related code into src/rdap/ directory structure - Split network helpers into modular files (asn.ts, ipv4.ts, ipv6.ts) - Created centralized exports via src/lib/network/index.ts - Migrated utility functions from src/helpers.ts to src/lib/utils.ts - Separated RDAP services into dedicated modules (rdap-api.ts, registry.ts, url-resolver.ts) This refactoring enhances code maintainability and follows a clearer separation of concerns.
63 lines
1.4 KiB
TypeScript
63 lines
1.4 KiB
TypeScript
import type { FunctionComponent, ReactNode } from "react";
|
|
import { CrossCircledIcon } from "@radix-ui/react-icons";
|
|
import { Callout, Box, Flex } from "@radix-ui/themes";
|
|
|
|
export type ErrorCardProps = {
|
|
title: ReactNode;
|
|
description?: ReactNode;
|
|
issues?: ReactNode[];
|
|
className?: string;
|
|
};
|
|
|
|
const ErrorCard: FunctionComponent<ErrorCardProps> = ({
|
|
title,
|
|
description,
|
|
issues,
|
|
className,
|
|
}) => {
|
|
return (
|
|
<Box className={className}>
|
|
<Callout.Root color="red" role="alert">
|
|
<Callout.Icon>
|
|
<CrossCircledIcon />
|
|
</Callout.Icon>
|
|
<Flex direction="column" gap="2">
|
|
<Callout.Text weight="medium" size="3">
|
|
{title}
|
|
</Callout.Text>
|
|
{description != undefined ? (
|
|
<Box
|
|
style={{
|
|
maxHeight: "6rem",
|
|
overflowY: "auto",
|
|
whiteSpace: "pre-wrap",
|
|
}}
|
|
>
|
|
<Callout.Text size="2">{description}</Callout.Text>
|
|
</Box>
|
|
) : null}
|
|
{issues != undefined && issues.length > 0 ? (
|
|
<Box asChild>
|
|
<ul
|
|
role="list"
|
|
style={{
|
|
listStyleType: "disc",
|
|
paddingLeft: "1.25rem",
|
|
}}
|
|
>
|
|
{issues.map((issueText, index) => (
|
|
<li key={index}>
|
|
<Callout.Text size="2">{issueText}</Callout.Text>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</Box>
|
|
) : null}
|
|
</Flex>
|
|
</Callout.Root>
|
|
</Box>
|
|
);
|
|
};
|
|
|
|
export default ErrorCard;
|