11import React from 'react' ;
22import { CircularProgress } from '../../base' ;
3- import { CopyIcon , KanvasIcon , PublishIcon } from '../../icons' ;
3+ import { CopyIcon , EditIcon , KanvasIcon , PublishIcon } from '../../icons' ;
44import Download from '../../icons/Download/Download' ;
55import { charcoal , useTheme } from '../../theme' ;
66import { Pattern } from '../CustomCatalog/CustomCard' ;
@@ -19,6 +19,8 @@ interface ActionButtonsProps {
1919 showUnpublishAction : boolean ;
2020 showOpenPlaygroundAction : boolean ;
2121 onOpenPlaygroundClick : ( designId : string , name : string ) => void ;
22+ showInfoAction ?: boolean ;
23+ handleInfoClick ?: ( ) => void ;
2224}
2325
2426const ActionButtons : React . FC < ActionButtonsProps > = ( {
@@ -31,12 +33,34 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
3133 showUnpublishAction,
3234 handleUnpublish,
3335 showOpenPlaygroundAction,
34- onOpenPlaygroundClick
36+ onOpenPlaygroundClick,
37+ showInfoAction,
38+ handleInfoClick
3539} ) => {
3640 const cleanedType = type . replace ( 'my-' , '' ) . replace ( / s $ / , '' ) ;
3741 const theme = useTheme ( ) ;
3842 return (
3943 < 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+ ) }
4064 { actionItems && (
4165 < div
4266 style = { {
@@ -49,17 +73,18 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
4973 < ActionButton
5074 sx = { {
5175 borderRadius : '0.2rem' ,
52- backgroundColor : theme . palette . background . brand ?. default ,
76+ backgroundColor : 'transparent' ,
77+ border : `1px solid ${ theme . palette . border . normal } ` ,
5378 gap : '10px' ,
54- color : charcoal [ 100 ]
79+ color : charcoal [ 10 ]
5580 } }
5681 onClick = { ( ) =>
5782 cleanedType === RESOURCE_TYPES . FILTERS
5883 ? downloadFilter ( details . id , details . name )
5984 : downloadYaml ( details . pattern_file , details . name )
6085 }
6186 >
62- < Download width = { 24 } height = { 24 } fill = { charcoal [ 100 ] } />
87+ < Download width = { 24 } height = { 24 } fill = { charcoal [ 10 ] } />
6388 Download
6489 </ ActionButton >
6590
@@ -68,8 +93,9 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
6893 sx = { {
6994 borderRadius : '0.2rem' ,
7095 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 } `
7399 } }
74100 onClick = { ( ) => handleClone ( details ?. name , details ?. id ) }
75101 disabled = { isCloneDisabled }
@@ -78,49 +104,51 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
78104 < CircularProgress size = { 24 } color = { 'inherit' } />
79105 ) : (
80106 < >
81- < CopyIcon width = { 24 } height = { 24 } fill = { charcoal [ 100 ] } />
107+ < CopyIcon width = { 24 } height = { 24 } fill = { charcoal [ 10 ] } />
82108 Clone
83109 </ >
84110 ) }
85111 </ ActionButton >
86112 ) }
87113 </ div >
88114 ) }
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- ) }
110115
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 >
124152 </ StyledActionWrapper >
125153 ) ;
126154} ;
0 commit comments