feat(frontend): add shadcn ui primitives and compatibility bridge

This commit is contained in:
Sagit
2026-02-19 05:14:42 +00:00
parent c5124a01e6
commit 12c50df6a7
43 changed files with 2839 additions and 0 deletions
@@ -0,0 +1,52 @@
import * as React from "react";
import {
Alert as BaseAlert,
AlertDescription,
AlertTitle,
} from "@/components/ui/alert";
type AlertColor = "default" | "success" | "warning" | "danger" | "primary";
type AlertVariant = "solid" | "flat" | "faded" | "bordered";
interface AlertProps extends Omit<React.ComponentProps<"div">, "color" | "title"> {
color?: AlertColor;
description?: React.ReactNode;
title?: React.ReactNode;
variant?: AlertVariant;
}
function mapVariant(color: AlertColor) {
if (color === "danger") {
return "destructive" as const;
}
if (color === "success") {
return "success" as const;
}
if (color === "warning") {
return "warning" as const;
}
return "default" as const;
}
export function Alert({
children,
color = "default",
description,
title,
variant,
...props
}: AlertProps) {
return (
<BaseAlert
className={variant === "flat" ? "bg-opacity-15" : undefined}
variant={mapVariant(color)}
{...props}
>
{title ? <AlertTitle>{title}</AlertTitle> : null}
{description ? <AlertDescription>{description}</AlertDescription> : null}
{!description && !title ? children : null}
</BaseAlert>
);
}