import { cn } from "../lib/utils";
import { Button } from "./button";
import type { ButtonProps } from "./button";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "./tooltip";
interface ButtonWithDisableTooltipProps extends ButtonProps {
tooltip: string;
}
export const ButtonWithDisableTooltip = ({
tooltip,
disabled,
className,
...props
}: ButtonWithDisableTooltipProps) => {
const ButtonComponent = (
);
if (disabled) {
// If the button is disabled, we wrap it in a tooltip since
// we don't want to show the tooltip if the button is enabled.
return (
{ButtonComponent}{tooltip}
);
}
return ButtonComponent;
};