Files
epolicy-dash-front/src/components/kri-editor/toolbar/ToolbarButton.tsx

36 lines
820 B
TypeScript

"use client";
import type { ReactNode, MouseEvent } from "react";
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
export type KriEditorToolbarButtonProps = {
active?: boolean;
disabled?: boolean;
title?: string;
onClick?: () => void;
children: ReactNode;
className?: string;
};
export function ToolbarButton({ active, disabled, title, onClick, children, className }: KriEditorToolbarButtonProps) {
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>
);
}