36 lines
769 B
TypeScript
36 lines
769 B
TypeScript
"use client";
|
|
|
|
import type { ReactNode, MouseEvent } from "react";
|
|
import { Button } from "@/components/ui/button";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
type Props = {
|
|
active?: boolean;
|
|
disabled?: boolean;
|
|
title?: string;
|
|
onClick?: () => void;
|
|
children: ReactNode;
|
|
className?: string;
|
|
};
|
|
|
|
export function ToolbarButton({ active, disabled, title, onClick, children, className }: Props) {
|
|
const onMouseDown = (e: MouseEvent) => {
|
|
e.preventDefault();
|
|
};
|
|
|
|
return (
|
|
<Button
|
|
type="button"
|
|
variant={active ? "secondary" : "ghost"}
|
|
size="sm"
|
|
disabled={disabled}
|
|
onMouseDown={onMouseDown}
|
|
onClick={onClick}
|
|
title={title}
|
|
className={cn("h-8 w-8 p-0", className)}
|
|
>
|
|
{children}
|
|
</Button>
|
|
);
|
|
}
|