File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ import React , { forwardRef } from 'react'
2
+
3
+ import Icon from '../../Icon'
4
+ import ListItemIcon from '../../ListItemIcon'
5
+ import ListItemText from '../../ListItemText'
6
+ import ActionsMenuItem from '../ActionsMenuItem'
7
+
8
+ const makeComponent = ( { label, icon, name } ) => {
9
+ const Component = forwardRef ( ( props , ref ) => {
10
+ return (
11
+ < ActionsMenuItem { ...props } ref = { ref } >
12
+ < ListItemIcon >
13
+ < Icon icon = { icon } />
14
+ </ ListItemIcon >
15
+ < ListItemText primary = { label } />
16
+ </ ActionsMenuItem >
17
+ )
18
+ } )
19
+
20
+ Component . displayName = name
21
+
22
+ return Component
23
+ }
24
+
25
+ export const makeAction = ( {
26
+ name,
27
+ label,
28
+ icon,
29
+ disabled,
30
+ displayCondition,
31
+ action
32
+ } ) => {
33
+ return {
34
+ name,
35
+ icon,
36
+ label,
37
+ disabled,
38
+ displayCondition,
39
+ action,
40
+ Component : makeComponent ( { label, icon, name } )
41
+ }
42
+ }
You can’t perform that action at this time.
0 commit comments