mirror of
https://github.com/block/buzz.git
synced 2026-11-09 02:41:57 +00:00
Signed-off-by: Taylor Ho <taylorkmho@gmail.com> Co-authored-by: klopez4212 <klopez4212@gmail.com> Co-authored-by: npub14vtk7pvazqrq9639qu7e560wnqtl0d53ca4gjuvq6jzf3k2el23qqlwa7f <ab176f059d100602ea25073d9a69ee9817f7b691c76a897180d48498d959faa2@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Marge <marge@users.noreply.github.com> Co-authored-by: npub1223z34hd7vtwc6qj4s7flsxkj644nlre2nthu7lrrmkumhu3xddsrx9r6w <52a228d6edf316ec6812ac3c9fc0d696ab59fc7954d77e7be31eedcddf91335b@sprout-oss.stage.blox.sqprod.co>
55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
import * as React from "react";
|
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
|
|
import { cn } from "@/shared/lib/cn";
|
|
|
|
const alertVariants = cva(
|
|
"relative w-full rounded-2xl px-3.5 py-2.5 text-xs text-foreground",
|
|
{
|
|
variants: {
|
|
variant: {
|
|
default: "bg-muted/40",
|
|
destructive: "bg-destructive/10",
|
|
},
|
|
},
|
|
defaultVariants: {
|
|
variant: "default",
|
|
},
|
|
},
|
|
);
|
|
|
|
const Alert = React.forwardRef<
|
|
HTMLDivElement,
|
|
React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
|
|
>(({ className, variant, ...props }, ref) => (
|
|
<div
|
|
className={cn(alertVariants({ variant }), className)}
|
|
ref={ref}
|
|
role="alert"
|
|
{...props}
|
|
/>
|
|
));
|
|
Alert.displayName = "Alert";
|
|
|
|
const AlertTitle = React.forwardRef<
|
|
HTMLParagraphElement,
|
|
React.HTMLAttributes<HTMLHeadingElement>
|
|
>(({ className, ...props }, ref) => (
|
|
<h5
|
|
className={cn("mb-1 font-medium leading-4 tracking-tight", className)}
|
|
ref={ref}
|
|
{...props}
|
|
/>
|
|
));
|
|
AlertTitle.displayName = "AlertTitle";
|
|
|
|
const AlertDescription = React.forwardRef<
|
|
HTMLParagraphElement,
|
|
React.HTMLAttributes<HTMLParagraphElement>
|
|
>(({ className, ...props }, ref) => (
|
|
<div className={cn("text-xs leading-5", className)} ref={ref} {...props} />
|
|
));
|
|
AlertDescription.displayName = "AlertDescription";
|
|
|
|
export { Alert, AlertDescription, AlertTitle };
|