From 78541889f54c89d4d1019b094fea0e0a389d4927 Mon Sep 17 00:00:00 2001 From: AlexisG Date: Tue, 3 Dec 2024 11:15:52 +0100 Subject: [PATCH] refactor: Use getIconWithlabel helper in openExternalLink action --- src/modules/actions/openExternalLink.jsx | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/modules/actions/openExternalLink.jsx b/src/modules/actions/openExternalLink.jsx index 724339cfd4..f42b5795a1 100644 --- a/src/modules/actions/openExternalLink.jsx +++ b/src/modules/actions/openExternalLink.jsx @@ -5,7 +5,7 @@ import Icon from 'cozy-ui/transpiled/react/Icon' import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon' import ListItemText from 'cozy-ui/transpiled/react/ListItemText' -import { HOME_LINK_HREF } from 'constants/config' +import { getIconWithlabel } from 'modules/public/OpenExternalLinkButton' import { openExternalLink as openExtLink } from 'modules/public/helpers' const makeComponent = (label, icon) => { @@ -25,17 +25,11 @@ const makeComponent = (label, icon) => { } export const openExternalLink = ({ t, isSharingShortcutCreated, link }) => { - const label = - link === HOME_LINK_HREF - ? t('Share.create-cozy') - : isSharingShortcutCreated - ? t('toolbar.menu_sync_cozy') - : t('toolbar.add_to_mine') - - const icon = - !isSharingShortcutCreated || link === HOME_LINK_HREF - ? 'to-the-cloud' - : 'sync' + const { icon, label } = getIconWithlabel({ + link, + isSharingShortcutCreated, + t + }) return { name: 'openExternalLink',