11import _ from 'lodash' ;
22import React from 'react' ;
33import { CircularProgress } from '../../base' ;
4- import { CopyIcon , KanvasIcon } from '../../icons' ;
4+ import { CopyIcon , KanvasIcon , PublishIcon } from '../../icons' ;
55import Download from '../../icons/Download/Download' ;
66import { charcoal } from '../../theme' ;
77import { Pattern } from '../CustomCatalog/CustomCard' ;
88import { downloadFilter , downloadYaml , slugify } from './helper' ;
9- import { ActionButton , LinkUrl , StyledActionWrapper } from './style' ;
9+ import { ActionButton , LinkUrl , StyledActionWrapper , UnpublishAction } from './style' ;
1010import { RESOURCE_TYPES } from './types' ;
1111
1212interface ActionButtonsProps {
@@ -17,8 +17,10 @@ interface ActionButtonsProps {
1717 isCloneLoading : boolean ;
1818 handleClone : ( name : string , id : string ) => void ;
1919 mode : string ;
20+ handleUnpublish : ( ) => void ;
2021 isCloneDisabled : boolean ;
2122 showOpenPlaygroundButton : boolean ;
23+ showUnpublishAction : boolean ;
2224}
2325
2426const ActionButtons : React . FC < ActionButtonsProps > = ( {
@@ -30,7 +32,9 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
3032 handleClone,
3133 mode,
3234 isCloneDisabled,
33- showOpenPlaygroundButton
35+ showOpenPlaygroundButton,
36+ showUnpublishAction,
37+ handleUnpublish
3438} ) => {
3539 const cleanedType = type . replace ( 'my-' , '' ) . replace ( / s $ / , '' ) ;
3640 const resourcePlaygroundType = Object . values ( {
@@ -112,6 +116,19 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
112116 </ ActionButton >
113117 </ LinkUrl >
114118 ) }
119+ { showUnpublishAction && (
120+ < UnpublishAction
121+ sx = { {
122+ borderRadius : '0.2rem' ,
123+ gap : '10px' ,
124+ width : '100%'
125+ } }
126+ onClick = { handleUnpublish }
127+ >
128+ < PublishIcon width = { 24 } height = { 24 } fill = { charcoal [ 10 ] } />
129+ Unpublish
130+ </ UnpublishAction >
131+ ) }
115132 </ StyledActionWrapper >
116133 ) ;
117134} ;
0 commit comments