From 5b64137237e44734a3c76e2f1c0a58e27fc38772 Mon Sep 17 00:00:00 2001 From: ephraimduncan Date: Mon, 20 Apr 2026 18:35:42 +0000 Subject: [PATCH] feat: redesign bulk action toolbar and add escape-to-clear --- .../envelopes-table-bulk-action-bar.tsx | 85 ++++++++++++++++--- 1 file changed, 71 insertions(+), 14 deletions(-) diff --git a/apps/remix/app/components/tables/envelopes-table-bulk-action-bar.tsx b/apps/remix/app/components/tables/envelopes-table-bulk-action-bar.tsx index 105d1929e..793751ae7 100644 --- a/apps/remix/app/components/tables/envelopes-table-bulk-action-bar.tsx +++ b/apps/remix/app/components/tables/envelopes-table-bulk-action-bar.tsx @@ -1,3 +1,5 @@ +import { useEffect } from 'react'; + import { useLingui } from '@lingui/react/macro'; import { Trans } from '@lingui/react/macro'; import { DownloadIcon, FolderInputIcon, Trash2Icon, XIcon } from 'lucide-react'; @@ -21,37 +23,92 @@ export const EnvelopesTableBulkActionBar = ({ }: EnvelopesTableBulkActionBarProps) => { const { t } = useLingui(); + useEffect(() => { + if (selectedCount === 0) { + return; + } + + const onKeyDown = (event: KeyboardEvent) => { + if (event.key === 'Escape') { + onClearSelection(); + } + }; + + window.addEventListener('keydown', onKeyDown); + return () => window.removeEventListener('keydown', onKeyDown); + }, [selectedCount, onClearSelection]); + if (selectedCount === 0) { return null; } return ( -
- - {selectedCount} selected - +
+
+ + {selectedCount} + + + selected + +
-
+
- {onDownloadClick && ( - )} - -
);