Skip to content

Commit

Permalink
chore: clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliano176 committed Mar 4, 2022
1 parent a49d589 commit 6386e9c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/shell/creation-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const CreationButton: FC<{ activeRoute?: AppRoute }> = ({ activeRoute })
() =>
actions?.find?.(
(a) => (a.group === activeRoute?.id || a.group === activeRoute?.app) && a.primary
) ?? actions?.find?.((a) => a.primary),
),
[actions, activeRoute?.app, activeRoute?.id]
);
const secondaryActions = useSecondaryActions(actions, activeRoute);
Expand All @@ -59,7 +59,16 @@ export const CreationButton: FC<{ activeRoute?: AppRoute }> = ({ activeRoute })
const onOpen = useCallback(() => {
setOpen(true);
}, []);
return activeRoute?.app === 'search' || activeRoute?.app === 'settings' ? (
return primaryAction ? (
<MultiButton
style={{ height: '42px' }}
background="primary"
label={primaryAction?.label ?? t('new', 'New')}
onClick={primaryAction?.click}
items={secondaryActions}
disabled={!primaryAction || primaryAction?.disabled}
/>
) : (
<Dropdown items={secondaryActions} onClose={onClose} onOpen={onOpen}>
<Button
style={{ height: '42px' }}
Expand All @@ -69,14 +78,5 @@ export const CreationButton: FC<{ activeRoute?: AppRoute }> = ({ activeRoute })
icon={open ? 'ChevronUp' : 'ChevronDown'}
/>
</Dropdown>
) : (
<MultiButton
style={{ height: '42px' }}
background="primary"
label={primaryAction?.label ?? t('new', 'New')}
onClick={primaryAction?.click}
items={secondaryActions}
disabled={!primaryAction || primaryAction?.disabled}
/>
);
};

0 comments on commit 6386e9c

Please sign in to comment.