mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-02 14:22:28 +08:00
35 lines
924 B
TypeScript
35 lines
924 B
TypeScript
import React from "react";
|
|
import { Button, buttonVariants } from "@/components/ui/button";
|
|
import {
|
|
Tooltip,
|
|
TooltipContent,
|
|
TooltipProvider,
|
|
TooltipTrigger,
|
|
} from "@/components/ui/tooltip";
|
|
import { type VariantProps } from "class-variance-authority";
|
|
|
|
interface ButtonWithTooltipProps
|
|
extends React.ComponentProps<"button">,
|
|
VariantProps<typeof buttonVariants> {
|
|
tooltipContent: string;
|
|
children: React.ReactNode;
|
|
asChild?: boolean;
|
|
}
|
|
|
|
export function ButtonWithTooltip({
|
|
tooltipContent,
|
|
children,
|
|
...buttonProps
|
|
}: ButtonWithTooltipProps) {
|
|
return (
|
|
<TooltipProvider>
|
|
<Tooltip>
|
|
<TooltipTrigger asChild>
|
|
<Button {...buttonProps}>{children}</Button>
|
|
</TooltipTrigger>
|
|
<TooltipContent>{tooltipContent}</TooltipContent>
|
|
</Tooltip>
|
|
</TooltipProvider>
|
|
);
|
|
}
|