1
1
import _ from 'lodash' ;
2
2
import React from 'react' ;
3
3
import { CircularProgress } from '../../base' ;
4
- import { CopyIcon , KanvasIcon } from '../../icons' ;
4
+ import { CopyIcon , KanvasIcon , PublishIcon } from '../../icons' ;
5
5
import Download from '../../icons/Download/Download' ;
6
6
import { charcoal } from '../../theme' ;
7
7
import { Pattern } from '../CustomCatalog/CustomCard' ;
8
8
import { downloadFilter , downloadYaml , slugify } from './helper' ;
9
- import { ActionButton , LinkUrl , StyledActionWrapper } from './style' ;
9
+ import { ActionButton , LinkUrl , StyledActionWrapper , UnpublishAction } from './style' ;
10
10
import { RESOURCE_TYPES } from './types' ;
11
11
12
12
interface ActionButtonsProps {
@@ -17,8 +17,10 @@ interface ActionButtonsProps {
17
17
isCloneLoading : boolean ;
18
18
handleClone : ( name : string , id : string ) => void ;
19
19
mode : string ;
20
+ handleUnpublish : ( ) => void ;
20
21
isCloneDisabled : boolean ;
21
22
showOpenPlaygroundButton : boolean ;
23
+ showUnpublishAction : boolean ;
22
24
}
23
25
24
26
const ActionButtons : React . FC < ActionButtonsProps > = ( {
@@ -30,7 +32,9 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
30
32
handleClone,
31
33
mode,
32
34
isCloneDisabled,
33
- showOpenPlaygroundButton
35
+ showOpenPlaygroundButton,
36
+ showUnpublishAction,
37
+ handleUnpublish
34
38
} ) => {
35
39
const cleanedType = type . replace ( 'my-' , '' ) . replace ( / s $ / , '' ) ;
36
40
const resourcePlaygroundType = Object . values ( {
@@ -112,6 +116,19 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
112
116
</ ActionButton >
113
117
</ LinkUrl >
114
118
) }
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
+ ) }
115
132
</ StyledActionWrapper >
116
133
) ;
117
134
} ;
0 commit comments