Skip to content

Commit 2409e81

Browse files
committed
fix: remove forwardRef from callout
1 parent 6e7b7e5 commit 2409e81

File tree

1 file changed

+14
-25
lines changed

1 file changed

+14
-25
lines changed

packages/ui-react/src/components/callout/callout.tsx

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
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";
32
import {
43
CheckIcon,
54
CircleAlertIcon,
65
InfoIcon,
76
type LucideIcon,
87
TriangleAlertIcon,
98
} from "lucide-react";
10-
import { forwardRef } from "react";
9+
1110
import { cn } from "../../lib/utils.js";
1211

1312
const calloutVariants = cva(
@@ -61,31 +60,21 @@ const variantIcons: Record<Variants, LucideIcon> = {
6160

6261
export type CalloutProps = React.HTMLAttributes<HTMLDivElement> &
6362
VariantProps<typeof calloutVariants> & {
64-
asChild?: boolean;
6563
icon?: LucideIcon;
6664
};
6765

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];
7469

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+
};
9079

9180
export { Callout };

0 commit comments

Comments
 (0)