Skip to content

Commit

Permalink
fix Unused constant Comp
Browse files Browse the repository at this point in the history
  • Loading branch information
kane50613 committed May 3, 2024
1 parent bcf548f commit 98eba8f
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/components/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { cva, type VariantProps } from "class-variance-authority";
import * as React from "react";

import { cn } from "@/lib/utils";
import { createElement } from "react";

const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 no-underline",
Expand Down Expand Up @@ -41,17 +42,13 @@ export interface ButtonProps
}

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
return (
<Comp
type="button"
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
);
},
({ className, variant, size, asChild = false, ...props }, ref) =>
createElement(asChild ? Slot : "button", {
type: "button",
className: cn(buttonVariants({ variant, size, className })),
ref,
...props,
}),
);
Button.displayName = "Button";

Expand Down

0 comments on commit 98eba8f

Please sign in to comment.