2025-07-11 00:30:44 +08:00
|
|
|
import { cn } from "@heroui/react"
|
2024-11-11 10:04:00 +08:00
|
|
|
import type { ReactNode } from "react"
|
2024-09-21 00:25:31 +08:00
|
|
|
|
2025-03-23 13:53:28 +08:00
|
|
|
interface ToolButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
2024-11-11 10:04:00 +08:00
|
|
|
children?: ReactNode
|
2025-07-11 00:30:44 +08:00
|
|
|
className?: string
|
|
|
|
|
selected?: boolean
|
2024-09-21 00:25:31 +08:00
|
|
|
}
|
2025-07-11 00:30:44 +08:00
|
|
|
export const ToolButton = ({ children, className, selected, ...rest }: ToolButtonProps) => {
|
2024-11-11 10:04:00 +08:00
|
|
|
return (
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
2025-07-11 00:30:44 +08:00
|
|
|
className={cn(
|
|
|
|
|
"flex flex-shrink-0 gap-0.5 active:scale-95 items-center min-w-7 justify-center px-2 py-1.5 bg-black/5 transition hover:bg-black/10 dark:bg-white/5 dark:hover:bg-white/10 rounded-md text-sm leading-none",
|
|
|
|
|
className,
|
|
|
|
|
selected &&
|
|
|
|
|
"bg-purple-500/40 hover:bg-purple-500/20 text-purple-900 dark:text-purple-100 drop-shadow-sm dark:bg-purple-500/40 dark:hover:bg-purple-500/20"
|
|
|
|
|
)}
|
2024-11-11 10:04:00 +08:00
|
|
|
{...rest}
|
|
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
</button>
|
|
|
|
|
)
|
|
|
|
|
}
|