File tree Expand file tree Collapse file tree 4 files changed +45
-31
lines changed Expand file tree Collapse file tree 4 files changed +45
-31
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export type ModalProps = {
21
21
overflow ?: boolean ;
22
22
actions ?: ButtonProps [ ] ;
23
23
vertical ?: boolean ;
24
+ btnVariant ?: ButtonProps [ 'variant' ] ;
24
25
bgColor ?: string ;
25
26
onClose ?: ( ) => void ;
26
27
onBackdropClick ?: ( ) => void ;
@@ -45,6 +46,7 @@ export const Base: React.FC<ModalProps> = (props) => {
45
46
overflow,
46
47
actions,
47
48
vertical = true ,
49
+ btnVariant,
48
50
bgColor,
49
51
children,
50
52
onBackdropClick,
@@ -121,15 +123,12 @@ export const Base: React.FC<ModalProps> = (props) => {
121
123
</ div >
122
124
< div className = { clsx ( `${ baseClass } -body` , { overflow } ) } > { children } </ div >
123
125
{ actions && (
124
- < div className = { `${ baseClass } -footer ${ baseClass } -footer--${ vertical ? 'v' : 'h' } ` } >
126
+ < div
127
+ className = { `${ baseClass } -footer ${ baseClass } -footer--${ vertical ? 'v' : 'h' } ` }
128
+ data-variant = { btnVariant || 'round' }
129
+ >
125
130
{ actions . map ( ( item ) => (
126
- < Button
127
- size = "lg"
128
- block = { isPopup }
129
- variant = { ! isPopup && vertical ? 'outline' : undefined }
130
- { ...item }
131
- key = { item . label }
132
- />
131
+ < Button size = "lg" block = { isPopup } variant = { btnVariant } { ...item } key = { item . label } />
133
132
) ) }
134
133
</ div >
135
134
) }
Original file line number Diff line number Diff line change @@ -3,5 +3,11 @@ import clsx from 'clsx';
3
3
import { Base , ModalProps } from './Base' ;
4
4
5
5
export const Confirm : React . FC < ModalProps > = ( { className, ...other } ) => (
6
- < Base baseClass = "Modal" className = { clsx ( 'Confirm' , className ) } showClose = { false } { ...other } />
6
+ < Base
7
+ baseClass = "Modal"
8
+ className = { clsx ( 'Confirm' , className ) }
9
+ showClose = { false }
10
+ btnVariant = "outline"
11
+ { ...other }
12
+ />
7
13
) ;
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import { Base , ModalProps } from './Base' ;
3
3
4
- export const Modal : React . FC < ModalProps > = ( props ) => < Base baseClass = "Modal" { ...props } /> ;
4
+ export const Modal : React . FC < ModalProps > = ( props ) => (
5
+ < Base
6
+ baseClass = "Modal"
7
+ btnVariant = { props . vertical === false ? undefined : 'outline' }
8
+ { ...props }
9
+ />
10
+ ) ;
Original file line number Diff line number Diff line change 25
25
.Modal-dialog {
26
26
position : relative ;
27
27
z-index : @zindex-modal ;
28
+ overflow : hidden ;
28
29
width : @modal-width ;
29
30
border-radius : @modal-border-radius ;
30
31
background : @modal-bg ;
55
56
56
57
.Modal-footer {
57
58
display : flex ;
59
+
60
+ .Btn--outline {
61
+ padding-top : 10px ;
62
+ padding-bottom : 10px ;
63
+ border-width : 1px 0 0 ;
64
+ border-color : var (--gray-6 );
65
+ border-radius : 0 ;
66
+
67
+ & :not (.Btn--primary ) {
68
+ color : var (--gray-2 );
69
+ }
70
+ }
58
71
}
59
72
60
73
.Modal-footer--h {
61
- padding : 0 15px 18px ;
74
+ & [data- variant= ' round' ] {
75
+ padding : 0 15px 18px ;
62
76
77
+ .Btn + .Btn {
78
+ margin-left : @modal-btn-x-spacing ;
79
+ }
80
+ }
81
+ & [data- variant= ' outline' ] {
82
+ .Btn + .Btn {
83
+ border-left-width : 1px ;
84
+ }
85
+ }
63
86
.Btn {
64
87
flex : 1 ;
65
88
}
66
- .Btn + .Btn {
67
- margin-left : @modal-btn-x-spacing ;
68
- }
69
89
}
70
90
71
91
.Modal-footer--v {
72
92
flex-direction : column ;
73
-
74
- .Btn {
75
- padding-top : 10px ;
76
- padding-bottom : 10px ;
77
- border : 0 ;
78
- border-top : @modal-btn-y-border-width solid @modal-btn-y-border-color ;
79
- border-radius : 0 ;
80
- background : @modal-btn-y-bg ;
81
- color : @modal-btn-y-color ;
82
-
83
- & :last-child {
84
- border-radius : 0 0 @modal-border-radius @modal-border-radius ;
85
- }
86
- }
87
- .Btn--primary {
88
- color : @modal-btn-y-primary-color ;
89
- }
90
93
}
91
94
92
95
// Confirm
You can’t perform that action at this time.
0 commit comments