25 lines
628 B
TypeScript
25 lines
628 B
TypeScript
type IconButtonProps = {
|
|
label: string;
|
|
children: React.ReactNode;
|
|
onClick?: () => void;
|
|
active?: boolean;
|
|
};
|
|
|
|
export function IconButton({ label, children, onClick, active = false }: IconButtonProps) {
|
|
return (
|
|
<button
|
|
type="button"
|
|
aria-label={label}
|
|
title={label}
|
|
onClick={onClick}
|
|
className={`grid h-10 w-10 place-items-center rounded border transition ${
|
|
active
|
|
? "border-slate-800 bg-slate-900 text-white"
|
|
: "border-transparent bg-[var(--glass-readable)] text-slate-700 shadow-sm hover:bg-white"
|
|
}`}
|
|
>
|
|
{children}
|
|
</button>
|
|
);
|
|
}
|