Skip to content

Commit

Permalink
refactor: Use getIconWithlabel helper in openExternalLink action
Browse files Browse the repository at this point in the history
  • Loading branch information
Merkur39 committed Dec 3, 2024
1 parent 44473aa commit 7854188
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/modules/actions/openExternalLink.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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',
Expand Down

0 comments on commit 7854188

Please sign in to comment.