File tree 3 files changed +21
-2
lines changed
3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 126
126
"path" : " ./node_modules/cz-conventional-changelog"
127
127
}
128
128
}
129
- }
129
+ }
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import * as R from 'ramda';
6
6
import useKeyUp from '../../utils/useKeyUp' ;
7
7
// Styles
8
8
import getStyles , { backdropStyles } from './popup.styles' ;
9
+ import { IconName } from '../icon' ;
10
+ import IconButton from '../icon-button' ;
9
11
10
12
export interface PopupProps extends Omit < BoxProps , 'css' > {
11
13
children : React . ReactNode ;
@@ -22,6 +24,7 @@ export interface PopupProps extends Omit<BoxProps, 'css'> {
22
24
disabledMainButton ?: boolean ;
23
25
footer ?: React . ReactNode ;
24
26
disabledSecondaryButton ?: boolean ;
27
+ hasCloseButton ?: boolean ;
25
28
}
26
29
27
30
const Popup : FC < PopupProps > = ( {
@@ -37,6 +40,7 @@ const Popup: FC<PopupProps> = ({
37
40
closeOnBackdropClick = true ,
38
41
footer,
39
42
onClose = ( ) => { } ,
43
+ hasCloseButton = false ,
40
44
sx,
41
45
...props
42
46
} : PopupProps ) => {
@@ -84,6 +88,14 @@ const Popup: FC<PopupProps> = ({
84
88
overflowX = "visible"
85
89
{ ...props }
86
90
>
91
+ { hasCloseButton && (
92
+ < IconButton
93
+ icon = { IconName . cross }
94
+ sx = { { position : 'absolute' , right : 10 , top : 10 } }
95
+ size = "lg"
96
+ onClick = { onClose }
97
+ />
98
+ ) }
87
99
{ children }
88
100
{ footer && (
89
101
< Box width = "100%" backgroundColor = "grayShade3" >
Original file line number Diff line number Diff line change @@ -43,7 +43,9 @@ const Template: Story<PopupProps> = (props) => {
43
43
return (
44
44
< div >
45
45
< Button onClick = { handleToggle } > Open Drawer</ Button >
46
- < Popup isOpen = { isOpen } onClose = { handleToggle } { ...props } />
46
+ < Popup isOpen = { isOpen } onClose = { handleToggle } { ...props } >
47
+ < div > this is children</ div >
48
+ </ Popup >
47
49
</ div >
48
50
) ;
49
51
} ;
@@ -299,4 +301,9 @@ Default.argTypes = {
299
301
summary : 'Is show backdrop' ,
300
302
} ,
301
303
} ,
304
+ hasCloseButton : {
305
+ control : {
306
+ type : 'boolean' ,
307
+ } ,
308
+ } ,
302
309
} ;
You can’t perform that action at this time.
0 commit comments