From a49d589781da33ae83389d26647ce9b8d91af60b Mon Sep 17 00:00:00 2001 From: Giuliano Caregnato Date: Mon, 28 Feb 2022 15:49:50 +0100 Subject: [PATCH 1/7] feat: changed behaviour of new button for search and settings modules --- src/shell/creation-button.tsx | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/shell/creation-button.tsx b/src/shell/creation-button.tsx index f7c6c989..ca29d8fa 100644 --- a/src/shell/creation-button.tsx +++ b/src/shell/creation-button.tsx @@ -4,9 +4,9 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import React, { FC, useMemo } from 'react'; +import React, { FC, useCallback, useMemo, useState } from 'react'; import { reduce, groupBy } from 'lodash'; -import { MultiButton } from '@zextras/carbonio-design-system'; +import { MultiButton, Button, Dropdown } from '@zextras/carbonio-design-system'; import { useTranslation } from 'react-i18next'; import { useLocation } from 'react-router-dom'; import { useActions } from '../store/integrations/hooks'; @@ -43,6 +43,7 @@ export const CreationButton: FC<{ activeRoute?: AppRoute }> = ({ activeRoute }) const [t] = useTranslation(); const location = useLocation(); const actions = useActions({ activeRoute, location }, ACTION_TYPES.NEW); + const [open, setOpen] = useState(false); const primaryAction = useMemo( () => actions?.find?.( @@ -52,7 +53,23 @@ export const CreationButton: FC<{ activeRoute?: AppRoute }> = ({ activeRoute }) ); const secondaryActions = useSecondaryActions(actions, activeRoute); - return ( + const onClose = useCallback(() => { + setOpen(false); + }, []); + const onOpen = useCallback(() => { + setOpen(true); + }, []); + return activeRoute?.app === 'search' || activeRoute?.app === 'settings' ? ( + +