2025-12-06 12:46:40 +09:00
|
|
|
import type { VariantProps } from "class-variance-authority"
|
|
|
|
|
import type React from "react"
|
|
|
|
|
import { Button, type buttonVariants } from "@/components/ui/button"
|
2025-03-26 10:32:33 +00:00
|
|
|
import {
|
|
|
|
|
Tooltip,
|
|
|
|
|
TooltipContent,
|
|
|
|
|
TooltipProvider,
|
|
|
|
|
TooltipTrigger,
|
2025-12-06 12:46:40 +09:00
|
|
|
} from "@/components/ui/tooltip"
|
2025-03-26 10:32:33 +00:00
|
|
|
|
|
|
|
|
interface ButtonWithTooltipProps
|
|
|
|
|
extends React.ComponentProps<"button">,
|
|
|
|
|
VariantProps<typeof buttonVariants> {
|
2025-12-06 12:46:40 +09:00
|
|
|
tooltipContent: string
|
|
|
|
|
children: React.ReactNode
|
|
|
|
|
asChild?: boolean
|
2025-03-26 10:32:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function ButtonWithTooltip({
|
|
|
|
|
tooltipContent,
|
|
|
|
|
children,
|
|
|
|
|
...buttonProps
|
|
|
|
|
}: ButtonWithTooltipProps) {
|
|
|
|
|
return (
|
|
|
|
|
<TooltipProvider>
|
|
|
|
|
<Tooltip>
|
|
|
|
|
<TooltipTrigger asChild>
|
|
|
|
|
<Button {...buttonProps}>{children}</Button>
|
|
|
|
|
</TooltipTrigger>
|
2025-12-06 12:46:40 +09:00
|
|
|
<TooltipContent className="max-w-xs text-wrap">
|
|
|
|
|
{tooltipContent}
|
|
|
|
|
</TooltipContent>
|
2025-03-26 10:32:33 +00:00
|
|
|
</Tooltip>
|
|
|
|
|
</TooltipProvider>
|
2025-12-06 12:46:40 +09:00
|
|
|
)
|
2025-03-26 10:32:33 +00:00
|
|
|
}
|