diff --git a/ui/src/common/components/interactions/ConfirmPopover/ConfirmPopover.test.tsx b/ui/src/common/components/interactions/ConfirmPopover/ConfirmPopover.test.tsx index 81d89602..c1c8378a 100644 --- a/ui/src/common/components/interactions/ConfirmPopover/ConfirmPopover.test.tsx +++ b/ui/src/common/components/interactions/ConfirmPopover/ConfirmPopover.test.tsx @@ -40,4 +40,32 @@ describe('ConfirmPopover', () => { fireEvent.click(screen.getByRole('button', { name: 'Cancel' })); expect(onCancel).toHaveBeenCalledTimes(1); }); + + const renderPopover = (destructive?: boolean) => + renderWithMantine( + open} + title="Remove?" + text="x" + onConfirm={vi.fn()} + onCancel={vi.fn()} + />, + ); + + it('renders a red OK button for destructive confirmations (#314)', () => { + renderPopover(true); + // Mantine color="red" inlines the red color custom properties on the button element. + expect( + screen.getByRole('button', { name: 'OK' }).getAttribute('style') ?? '', + ).toContain('red'); + }); + + it('renders a default (non-red) OK button when not destructive', () => { + renderPopover(false); + expect( + screen.getByRole('button', { name: 'OK' }).getAttribute('style') ?? '', + ).not.toContain('red'); + }); }); diff --git a/ui/src/common/components/interactions/ConfirmPopover/ConfirmPopover.tsx b/ui/src/common/components/interactions/ConfirmPopover/ConfirmPopover.tsx index 0fc8c0dc..8b36f3f4 100644 --- a/ui/src/common/components/interactions/ConfirmPopover/ConfirmPopover.tsx +++ b/ui/src/common/components/interactions/ConfirmPopover/ConfirmPopover.tsx @@ -23,6 +23,8 @@ interface ConfirmPopoverProps extends PopoverProps { text: string; onConfirm: () => void; onCancel: () => void; + // Render the confirm (OK) button in red for destructive actions (remove/delete/unshare). (#314) + destructive?: boolean; } export function ConfirmPopover({ @@ -31,6 +33,7 @@ export function ConfirmPopover({ text, onConfirm, onCancel, + destructive, ...rest }: Readonly) { return ( @@ -79,6 +82,7 @@ export function ConfirmPopover({