|
1 |
| -import { Slot } from "@radix-ui/react-slot"; |
2 |
| -import { type VariantProps, cva } from "class-variance-authority"; |
| 1 | +import { cva, type VariantProps } from "class-variance-authority"; |
3 | 2 | import {
|
4 | 3 | CheckIcon,
|
5 | 4 | CircleAlertIcon,
|
6 | 5 | InfoIcon,
|
7 | 6 | type LucideIcon,
|
8 | 7 | TriangleAlertIcon,
|
9 | 8 | } from "lucide-react";
|
10 |
| -import { forwardRef } from "react"; |
| 9 | + |
11 | 10 | import { cn } from "../../lib/utils.js";
|
12 | 11 |
|
13 | 12 | const calloutVariants = cva(
|
@@ -61,31 +60,21 @@ const variantIcons: Record<Variants, LucideIcon> = {
|
61 | 60 |
|
62 | 61 | export type CalloutProps = React.HTMLAttributes<HTMLDivElement> &
|
63 | 62 | VariantProps<typeof calloutVariants> & {
|
64 |
| - asChild?: boolean; |
65 | 63 | icon?: LucideIcon;
|
66 | 64 | };
|
67 | 65 |
|
68 |
| -const Callout = forwardRef<HTMLDivElement, CalloutProps>( |
69 |
| - ({ className, asChild = false, variant, children, ...props }, ref) => { |
70 |
| - const Comp = asChild ? Slot : "div"; |
71 |
| - |
72 |
| - variant = variant || "default"; |
73 |
| - const Icon = props.icon || variantIcons[variant]; |
| 66 | +const Callout = ({ className, variant, children, ...props }: CalloutProps) => { |
| 67 | + variant = variant || "default"; |
| 68 | + const Icon = props.icon || variantIcons[variant]; |
74 | 69 |
|
75 |
| - return ( |
76 |
| - <Comp |
77 |
| - className={cn(calloutVariants({ variant, className }))} |
78 |
| - ref={ref} |
79 |
| - {...props} |
80 |
| - > |
81 |
| - <div> |
82 |
| - <Icon className="h-6 w-6 text-(--callout-icon-color)" /> |
83 |
| - </div> |
84 |
| - {children} |
85 |
| - </Comp> |
86 |
| - ); |
87 |
| - }, |
88 |
| -); |
89 |
| -Callout.displayName = "Callout"; |
| 70 | + return ( |
| 71 | + <div className={cn(calloutVariants({ variant, className }))} {...props}> |
| 72 | + <div> |
| 73 | + <Icon className="h-6 w-6 text-(--callout-icon-color)" /> |
| 74 | + </div> |
| 75 | + {children} |
| 76 | + </div> |
| 77 | + ); |
| 78 | +}; |
90 | 79 |
|
91 | 80 | export { Callout };
|
0 commit comments