mirror of
https://github.com/formbricks/formbricks.git
synced 2026-05-03 03:14:34 -05:00
26b4fd9b3e
* add attribute filtering to surveys --------- Co-authored-by: Johannes <johannes@formbricks.com>
48 lines
1.7 KiB
TypeScript
48 lines
1.7 KiB
TypeScript
import * as React from "react";
|
|
import { VariantProps, cva } from "class-variance-authority";
|
|
|
|
import { cn } from "@formbricks/lib/cn";
|
|
|
|
const alertVariants = cva(
|
|
"relative w-full rounded-lg border p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11",
|
|
{
|
|
variants: {
|
|
variant: {
|
|
default: "bg-background text-foreground",
|
|
destructive:
|
|
"text-destructive border-destructive/50 dark:border-destructive [&>svg]:text-destructive text-destructive",
|
|
},
|
|
},
|
|
defaultVariants: {
|
|
variant: "default",
|
|
},
|
|
}
|
|
);
|
|
|
|
const Alert = React.forwardRef<
|
|
HTMLDivElement,
|
|
React.HTMLAttributes<HTMLDivElement> &
|
|
VariantProps<typeof alertVariants> & { dangerouslySetInnerHTML?: { __html: string } }
|
|
>(({ className, variant, ...props }, ref) => (
|
|
<div ref={ref} role="alert" className={cn(alertVariants({ variant }), className)} {...props} />
|
|
));
|
|
Alert.displayName = "Alert";
|
|
|
|
const AlertTitle = React.forwardRef<
|
|
HTMLParagraphElement,
|
|
React.HTMLAttributes<HTMLHeadingElement> & { dangerouslySetInnerHTML?: { __html: string } }
|
|
>(({ className, ...props }, ref) => (
|
|
<h5 ref={ref} className={cn("mb-1 font-medium leading-none tracking-tight", className)} {...props} />
|
|
));
|
|
AlertTitle.displayName = "AlertTitle";
|
|
|
|
const AlertDescription = React.forwardRef<
|
|
HTMLParagraphElement,
|
|
React.HTMLAttributes<HTMLParagraphElement> & { dangerouslySetInnerHTML?: { __html: string } }
|
|
>(({ className, ...props }, ref) => (
|
|
<div ref={ref} className={cn("text-sm [&_p]:leading-relaxed", className)} {...props} />
|
|
));
|
|
AlertDescription.displayName = "AlertDescription";
|
|
|
|
export { Alert, AlertTitle, AlertDescription };
|