From 03382b73175b47753928eee39fe893390874bf31 Mon Sep 17 00:00:00 2001 From: Ian Bolton Date: Wed, 21 Feb 2024 10:59:00 -0500 Subject: [PATCH] :bug: Reuse toggle component for apps table Signed-off-by: Ian Bolton --- client/src/app/components/KebabDropdown.tsx | 1 + .../applications-table/applications-table.tsx | 33 ++++--------------- 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/client/src/app/components/KebabDropdown.tsx b/client/src/app/components/KebabDropdown.tsx index 3224c6fe06..bf0d2412ec 100644 --- a/client/src/app/components/KebabDropdown.tsx +++ b/client/src/app/components/KebabDropdown.tsx @@ -24,6 +24,7 @@ export const KebabDropdown: React.FC = ({ popperProps={{ position: "right" }} isOpen={isOpen} onOpenChange={(isOpen) => setIsOpen(isOpen)} + shouldFocusToggleOnSelect toggle={(toggleRef: React.Ref) => ( { const { t } = useTranslation(); @@ -114,8 +112,6 @@ export const ApplicationsTable: React.FC = () => { const { pushNotification } = React.useContext(NotificationsContext); const { identities } = useFetchIdentities(); - const [isToolbarKebabOpen, setIsToolbarKebabOpen] = - React.useState(false); const [saveApplicationModalState, setSaveApplicationModalState] = React.useState<"create" | Application | null>(null); @@ -798,27 +794,10 @@ export const ApplicationsTable: React.FC = () => { {dropdownItems.length ? ( - setIsToolbarKebabOpen(false)} - onOpenChange={(_isOpen) => setIsToolbarKebabOpen(false)} - toggle={(toggleRef: React.Ref) => ( - - setIsToolbarKebabOpen(!isToolbarKebabOpen) - } - isExpanded={isToolbarKebabOpen} - > - - - )} - shouldFocusToggleOnSelect - > - {dropdownItems} - + ) : ( <>