260703_01_FST: First Commit
This commit is contained in:
35
registry/components/kri-editor/toolbar/ToolbarButton.tsx
Normal file
35
registry/components/kri-editor/toolbar/ToolbarButton.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
"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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user