File tree Expand file tree Collapse file tree 3 files changed +42
-18
lines changed
Expand file tree Collapse file tree 3 files changed +42
-18
lines changed Original file line number Diff line number Diff line change @@ -57,8 +57,8 @@ const getStories = () => {
5757 "./components/Colors/Colors.stories.tsx" : require ( "../components/Colors/Colors.stories.tsx" ) ,
5858 "./components/DateSelector/DateField.stories.tsx" : require ( "../components/DateSelector/DateField.stories.tsx" ) ,
5959 "./components/DateSelector/DateSelector.stories.tsx" : require ( "../components/DateSelector/DateSelector.stories.tsx" ) ,
60- "./components/Dialog/Dialog.stories.tsx" : require ( "../components/Dialog/Dialog.stories.tsx" ) ,
6160 "./components/Divider/Divider.stories.tsx" : require ( "../components/Divider/Divider.stories.tsx" ) ,
61+ "./components/Modals/Modals.stories.tsx" : require ( "../components/Modals/Modals.stories.tsx" ) ,
6262 "./components/NumberField/NumberField.stories.tsx" : require ( "../components/NumberField/NumberField.stories.tsx" ) ,
6363 "./components/Tag/Tag.stories.tsx" : require ( "../components/Tag/Tag.stories.tsx" ) ,
6464 "./components/TextField/TextField.stories.tsx" : require ( "../components/TextField/TextField.stories.tsx" ) ,
Original file line number Diff line number Diff line change @@ -24,8 +24,9 @@ export default {
2424 control : { type : 'radio' } ,
2525 options : [ 'left' , 'center' ] ,
2626 } ,
27- haveSecondButton : {
28- control : { type : 'boolean' } ,
27+ haveMoreButtons : {
28+ control : { type : 'radio' } ,
29+ options : [ '0' , '1' , '2' ] ,
2930 } ,
3031 name : { control : { type : 'select' } , options : IconsName } ,
3132 disabled : { control : { type : 'boolean' } } ,
@@ -53,7 +54,7 @@ export default {
5354 Controle des Bouton :
5455 \`\`\`
5556 {{
56- confirm : {
57+ cta : {
5758 label: 'Valider',
5859 onPress: () => {},
5960 },
@@ -95,20 +96,29 @@ export const Default: Story = {
9596 { ...args }
9697 visible = { true }
9798 actions = { {
98- confirm : {
99- label : 'Valider ' ,
99+ cta : {
100+ label : 'Confirm ' ,
100101 disabled : args . disabled ,
101102 loading : args . loading ,
102103 // eslint-disable-next-line @typescript-eslint/no-empty-function
103104 onPress : ( ) => { } ,
104105 } ,
105- cancel : args ?. haveSecondButton
106- ? {
107- label : 'Annuler' ,
108- // eslint-disable-next-line @typescript-eslint/no-empty-function
109- onPress : ( ) => { } ,
110- }
111- : undefined ,
106+ cancel :
107+ args ?. haveMoreButtons >= '1'
108+ ? {
109+ label : 'Cancel' ,
110+ // eslint-disable-next-line @typescript-eslint/no-empty-function
111+ onPress : ( ) => { } ,
112+ }
113+ : undefined ,
114+ secondary :
115+ args ?. haveMoreButtons >= '2'
116+ ? {
117+ label : 'Verify' ,
118+ // eslint-disable-next-line @typescript-eslint/no-empty-function
119+ onPress : ( ) => { } ,
120+ }
121+ : undefined ,
112122 } }
113123 >
114124 < InsideDialog variantBody = { args ?. variant ?? 'left' } />
Original file line number Diff line number Diff line change @@ -15,8 +15,9 @@ interface Action {
1515}
1616
1717interface ModalActions {
18- confirm : Action ;
18+ cta : Action ;
1919 cancel ?: Action ;
20+ secondary ?: Action ;
2021}
2122
2223export interface ModalProps extends PropsWithChildren {
@@ -80,16 +81,29 @@ export const Modal = (props: ModalProps) => {
8081 { props . actions . cancel . label }
8182 </ Button >
8283 ) }
84+ { props . actions . secondary && (
85+ < Button
86+ variant = "outlined"
87+ status = { 'default' }
88+ onPress = { props . actions . secondary . onPress }
89+ testID = { 'PopupSecondaryButton' }
90+ style = { styles . leftOption }
91+ loading = { props . actions . secondary . loading ?? false }
92+ disabled = { props . actions . secondary . disabled ?? false }
93+ >
94+ { props . actions . secondary . label }
95+ </ Button >
96+ ) }
8397 < Button
8498 variant = "filled"
8599 status = { 'primary' }
86- onPress = { props . actions . confirm . onPress }
100+ onPress = { props . actions . cta . onPress }
87101 testID = { 'PopupConfirmButton' }
88102 style = { styles . rightOption }
89- loading = { props . actions . confirm . loading ?? false }
90- disabled = { props . actions . confirm . disabled ?? false }
103+ loading = { props . actions . cta . loading ?? false }
104+ disabled = { props . actions . cta . disabled ?? false }
91105 >
92- { props . actions . confirm . label }
106+ { props . actions . cta . label }
93107 </ Button >
94108 </ View >
95109 </ BaseDialog >
You can’t perform that action at this time.
0 commit comments