-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Replace qualify action with infos action
- Loading branch information
Showing
8 changed files
with
53 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React, { forwardRef } from 'react' | ||
|
||
import { isFile } from 'cozy-client/dist/models/file' | ||
import ActionsMenuItem from 'cozy-ui/transpiled/react/ActionsMenu/ActionsMenuItem' | ||
import Icon from 'cozy-ui/transpiled/react/Icon' | ||
import InfoIcon from 'cozy-ui/transpiled/react/Icons/Info' | ||
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon' | ||
import ListItemText from 'cozy-ui/transpiled/react/ListItemText' | ||
|
||
const makeComponent = (label, icon) => { | ||
const Component = forwardRef((props, ref) => { | ||
return ( | ||
<ActionsMenuItem {...props} ref={ref}> | ||
<ListItemIcon> | ||
<Icon icon={icon} /> | ||
</ListItemIcon> | ||
<ListItemText primary={label} /> | ||
</ActionsMenuItem> | ||
) | ||
}) | ||
|
||
Component.displayName = 'infos' | ||
|
||
return Component | ||
} | ||
|
||
export const infos = ({ t, navigate }) => { | ||
const icon = InfoIcon | ||
const label = t('actions.infos') | ||
|
||
return { | ||
name: 'infos', | ||
icon, | ||
label, | ||
displayCondition: docs => isFile(docs[0]), | ||
Component: makeComponent(label, icon), | ||
action: docs => { | ||
navigate(`file/${docs[0]._id}`) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters