Files
wehub-resource-sync c48612c494
CI / E2E Tests (push) Has been cancelled
CI / Lint, Typecheck & Unit Tests (push) Has been cancelled
Docs Build / Build docs site (push) Has been cancelled
Publish @openmaic packages / Build, validate & publish (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:03:23 +08:00

24 lines
943 B
TypeScript

'use client';
import { Trash2 } from 'lucide-react';
import { useI18n } from '@/lib/hooks/use-i18n';
import { deleteSlideElement } from './use-slide-surface';
/** Trash button for the anchored bars — deletes the element and clears the selection. */
export function DeleteButton({ elementId }: { readonly elementId: string }) {
const { t } = useI18n();
return (
<button
type="button"
aria-label={t('edit.delete')}
// preventDefault on mousedown keeps the canvas selection alive until the
// click fires; the op then deletes the element.
onMouseDown={(e) => e.preventDefault()}
onClick={() => deleteSlideElement(elementId)}
className="flex h-8 w-8 items-center justify-center rounded-md text-zinc-500 transition-colors hover:bg-rose-50 hover:text-rose-600 dark:text-zinc-400 dark:hover:bg-rose-950/40 dark:hover:text-rose-400"
>
<Trash2 className="h-4 w-4" />
</button>
);
}