1
1
import React from 'react' ;
2
2
import { CircularProgress } from '../../base' ;
3
- import { CopyIcon , KanvasIcon , PublishIcon } from '../../icons' ;
3
+ import { CopyIcon , EditIcon , KanvasIcon , PublishIcon } from '../../icons' ;
4
4
import Download from '../../icons/Download/Download' ;
5
5
import { charcoal , useTheme } from '../../theme' ;
6
6
import { Pattern } from '../CustomCatalog/CustomCard' ;
@@ -19,6 +19,8 @@ interface ActionButtonsProps {
19
19
showUnpublishAction : boolean ;
20
20
showOpenPlaygroundAction : boolean ;
21
21
onOpenPlaygroundClick : ( designId : string , name : string ) => void ;
22
+ showInfoAction ?: boolean ;
23
+ handleInfoClick ?: ( ) => void ;
22
24
}
23
25
24
26
const ActionButtons : React . FC < ActionButtonsProps > = ( {
@@ -31,12 +33,34 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
31
33
showUnpublishAction,
32
34
handleUnpublish,
33
35
showOpenPlaygroundAction,
34
- onOpenPlaygroundClick
36
+ onOpenPlaygroundClick,
37
+ showInfoAction,
38
+ handleInfoClick
35
39
} ) => {
36
40
const cleanedType = type . replace ( 'my-' , '' ) . replace ( / s $ / , '' ) ;
37
41
const theme = useTheme ( ) ;
38
42
return (
39
43
< StyledActionWrapper >
44
+ { showOpenPlaygroundAction && (
45
+ < ActionButton
46
+ sx = { {
47
+ borderRadius : '0.2rem' ,
48
+ backgroundColor : theme . palette . background . cta ?. default ,
49
+ color : theme . palette . text . inverse ,
50
+ gap : '10px' ,
51
+ width : '100%'
52
+ } }
53
+ onClick = { ( ) => onOpenPlaygroundClick ( details . id , details . name ) }
54
+ >
55
+ < KanvasIcon
56
+ width = { 24 }
57
+ height = { 24 }
58
+ primaryFill = { theme . palette . icon . inverse }
59
+ fill = { theme . palette . icon . default }
60
+ />
61
+ Open in Playground
62
+ </ ActionButton >
63
+ ) }
40
64
{ actionItems && (
41
65
< div
42
66
style = { {
@@ -49,17 +73,18 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
49
73
< ActionButton
50
74
sx = { {
51
75
borderRadius : '0.2rem' ,
52
- backgroundColor : theme . palette . background . brand ?. default ,
76
+ backgroundColor : 'transparent' ,
77
+ border : `1px solid ${ theme . palette . border . normal } ` ,
53
78
gap : '10px' ,
54
- color : charcoal [ 100 ]
79
+ color : charcoal [ 10 ]
55
80
} }
56
81
onClick = { ( ) =>
57
82
cleanedType === RESOURCE_TYPES . FILTERS
58
83
? downloadFilter ( details . id , details . name )
59
84
: downloadYaml ( details . pattern_file , details . name )
60
85
}
61
86
>
62
- < Download width = { 24 } height = { 24 } fill = { charcoal [ 100 ] } />
87
+ < Download width = { 24 } height = { 24 } fill = { charcoal [ 10 ] } />
63
88
Download
64
89
</ ActionButton >
65
90
@@ -68,8 +93,9 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
68
93
sx = { {
69
94
borderRadius : '0.2rem' ,
70
95
gap : '10px' ,
71
- color : charcoal [ 100 ] ,
72
- backgroundColor : theme . palette . background . cta ?. default
96
+ color : theme . palette . text . default ,
97
+ backgroundColor : 'transparent' ,
98
+ border : `1px solid ${ theme . palette . border . normal } `
73
99
} }
74
100
onClick = { ( ) => handleClone ( details ?. name , details ?. id ) }
75
101
disabled = { isCloneDisabled }
@@ -78,49 +104,51 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
78
104
< CircularProgress size = { 24 } color = { 'inherit' } />
79
105
) : (
80
106
< >
81
- < CopyIcon width = { 24 } height = { 24 } fill = { charcoal [ 100 ] } />
107
+ < CopyIcon width = { 24 } height = { 24 } fill = { charcoal [ 10 ] } />
82
108
Clone
83
109
</ >
84
110
) }
85
111
</ ActionButton >
86
112
) }
87
113
</ div >
88
114
) }
89
- { showOpenPlaygroundAction && (
90
- < ActionButton
91
- sx = { {
92
- borderRadius : '0.2rem' ,
93
- backgroundColor : 'transparent' ,
94
- border : `1px solid ${ theme . palette . border . normal } ` ,
95
- color : theme . palette . text . default ,
96
- gap : '10px' ,
97
- width : '100%'
98
- } }
99
- onClick = { ( ) => onOpenPlaygroundClick ( details . id , details . name ) }
100
- >
101
- < KanvasIcon
102
- width = { 24 }
103
- height = { 24 }
104
- primaryFill = { theme . palette . icon . default }
105
- fill = { theme . palette . icon . default }
106
- />
107
- Open in Playground
108
- </ ActionButton >
109
- ) }
110
115
111
- { showUnpublishAction && (
112
- < UnpublishAction
113
- sx = { {
114
- borderRadius : '0.2rem' ,
115
- gap : '10px' ,
116
- width : '100%'
117
- } }
118
- onClick = { handleUnpublish }
119
- >
120
- < PublishIcon width = { 24 } height = { 24 } fill = { charcoal [ 10 ] } />
121
- Unpublish
122
- </ UnpublishAction >
123
- ) }
116
+ < div
117
+ style = { {
118
+ display : 'flex' ,
119
+ flexDirection : 'row' ,
120
+ gap : '0.75rem' ,
121
+ width : '100%'
122
+ } }
123
+ >
124
+ { showInfoAction && (
125
+ < ActionButton
126
+ sx = { {
127
+ borderRadius : '0.2rem' ,
128
+ backgroundColor : 'transparent' ,
129
+ border : `1px solid ${ theme . palette . border . normal } ` ,
130
+ gap : '10px' ,
131
+ color : charcoal [ 10 ]
132
+ } }
133
+ onClick = { handleInfoClick }
134
+ >
135
+ < EditIcon width = { 24 } height = { 24 } fill = { charcoal [ 10 ] } />
136
+ Edit
137
+ </ ActionButton >
138
+ ) }
139
+ { showUnpublishAction && (
140
+ < UnpublishAction
141
+ sx = { {
142
+ borderRadius : '0.2rem' ,
143
+ gap : '10px'
144
+ } }
145
+ onClick = { handleUnpublish }
146
+ >
147
+ < PublishIcon width = { 24 } height = { 24 } fill = { charcoal [ 100 ] } />
148
+ Unpublish
149
+ </ UnpublishAction >
150
+ ) }
151
+ </ div >
124
152
</ StyledActionWrapper >
125
153
) ;
126
154
} ;
0 commit comments