From 81ad682b64c95da3dfd18a06bb81bbfa8a887108 Mon Sep 17 00:00:00 2001 From: Ian Bolton Date: Thu, 22 Feb 2024 15:32:44 -0500 Subject: [PATCH] :bug: Reuse toggle component for apps table (#1692) https://issues.redhat.com/browse/MTA-1807 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(); @@ -115,8 +113,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); @@ -799,27 +795,10 @@ export const ApplicationsTable: React.FC = () => { {dropdownItems.length ? ( - setIsToolbarKebabOpen(false)} - onOpenChange={(_isOpen) => setIsToolbarKebabOpen(false)} - toggle={(toggleRef: React.Ref) => ( - - setIsToolbarKebabOpen(!isToolbarKebabOpen) - } - isExpanded={isToolbarKebabOpen} - > - - - )} - shouldFocusToggleOnSelect - > - {dropdownItems} - + ) : ( <>