mirror of
https://github.com/Infisical/infisical.git
synced 2026-01-08 23:18:05 -05:00
64 lines
1.7 KiB
TypeScript
64 lines
1.7 KiB
TypeScript
/* eslint-disable react/prop-types */
|
|
|
|
import * as React from "react";
|
|
import { cva, type VariantProps } from "cva";
|
|
|
|
import { cn } from "../../utils";
|
|
|
|
const alertVariants = cva(
|
|
"relative w-full border px-4 rounded-md py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
|
|
{
|
|
variants: {
|
|
variant: {
|
|
default: "bg-container text-card-foreground",
|
|
info: "bg-info/5 text-info border-info/20",
|
|
org: "bg-org/5 text-org border-org/20",
|
|
"sub-org": "bg-sub-org/5 text-sub-org border-sub-org/20"
|
|
}
|
|
},
|
|
defaultVariants: {
|
|
variant: "default"
|
|
}
|
|
}
|
|
);
|
|
|
|
function UnstableAlert({
|
|
className,
|
|
variant,
|
|
...props
|
|
}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
|
|
return (
|
|
<div
|
|
data-slot="alert"
|
|
role="alert"
|
|
className={cn(alertVariants({ variant }), className)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function UnstableAlertTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
return (
|
|
<div
|
|
data-slot="alert-title"
|
|
className={cn("col-start-2 line-clamp-1 min-h-4 tracking-tight text-foreground", className)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function UnstableAlertDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
return (
|
|
<div
|
|
data-slot="alert-description"
|
|
className={cn(
|
|
"col-start-2 grid justify-items-start gap-1 text-sm text-foreground/75 [&_p]:leading-relaxed",
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export { UnstableAlert, UnstableAlertDescription, UnstableAlertTitle };
|