Files
CoHaiSe-CLOUD/frontend/src/components/IconAction.tsx
T
Esiah 8637ae5e75
PR — Ouverture automatique / create-pr (push) Successful in 2s
refactor(ui): switch icons to WebP and standardize icon-only actions
- Replace PNG icon assets with WebP in public/icons
- Route every icon through icons.tsx and add missing exports
  (Clear, Save, OpenedFolder, Deactivate, PasswordReset, TrashEmpty, Filter)
- Replace text buttons with icon-only actions backed by tooltips
- Unify confirm/delete/primary dialog buttons on the accent red
- Use liquid glass hover on chat messages
2026-11-04 11:43:49 +01:00

47 lines
1.4 KiB
TypeScript

import type { ReactNode } from "react";
import { Spinner, cn } from "../ui/index.js";
export const IconAction = ({
label,
icon,
onClick,
isLoading = false,
tone = "neutral",
badge = 0,
className,
disabled = false,
}: {
label: string;
icon: ReactNode;
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
isLoading?: boolean;
tone?: "neutral" | "danger";
badge?: number;
className?: string;
disabled?: boolean;
}) => (
<button
type="button"
title={label}
aria-label={label}
disabled={isLoading || disabled}
onClick={onClick}
className={cn(
"group relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-all",
"hover:-translate-y-0.5 hover:bg-surface/60 hover:text-foreground hover:shadow-sm backdrop-blur-sm disabled:pointer-events-none disabled:opacity-50",
tone === "danger" && "hover:text-destructive",
className,
)}
>
{isLoading ? <Spinner size="xs" /> : icon}
{badge > 0 ? (
<span
aria-hidden="true"
className="pointer-events-none absolute -right-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-accent-graphic px-1 font-display text-[0.625rem] font-semibold leading-none text-accent-foreground"
>
{badge > 99 ? "99+" : badge}
</span>
) : null}
</button>
);