Skip to content

Commit

Permalink
Simplify.
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkambic committed Oct 14, 2024
1 parent 3ca94a9 commit 2b96fb4
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,20 @@ export const ShowAllSpaces: React.FC = () => {
};

const SelectablePopover = () => {
const [isPopoverOpen, setPopover] = useState(false);
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
const { space } = useKibanaSpace();

const {
pageState: { showFromAllSpaces },
} = useSelector(selectOverviewState);
const dispatch = useDispatch();

const onButtonClick = () => {
setPopover(!isPopoverOpen);
};
const closePopover = () => {
setPopover(false);
};

const button = (
<EuiButtonEmpty
data-test-subj="syntheticsClickMeToLoadAContextMenuButton"
iconType="arrowDown"
iconSide="right"
onClick={onButtonClick}
onClick={() => setIsPopoverOpen(!isPopoverOpen)}
size="xs"
>
{showFromAllSpaces ? ALL_SPACES_LABEL : space?.name || space?.id}
Expand All @@ -74,7 +67,7 @@ const SelectablePopover = () => {
id="contextMenuSpaces"
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
closePopover={() => setIsPopoverOpen(false)}
panelPaddingSize="none"
anchorPosition="downLeft"
>
Expand Down

0 comments on commit 2b96fb4

Please sign in to comment.