@@ -24,57 +24,77 @@ const Footer = () => {
2424
2525 const t = useTranslations ( 'footer' ) ;
2626
27- return (
28- < div style = { { height : '200px' } } >
29- { footerComponent && < div > { footerComponent } </ div > } { ' ' }
30- < div style = { { display : 'flex' , gap : '16px' } } >
31- { rhf . formState . isValid &&
32- ! allowUntouchedSubmit &&
33- ! rhf . formState . isDirty && (
34- < div > Het formulier is nog niet aangepast </ div >
35- ) }
27+ const PreviousButton = ( ) => (
28+ < button
29+ type = "button"
30+ onClick = { ( ) => onPrevious ?. ( ) }
31+ style = { { padding : '12px' } }
32+ >
33+ { t ( 'previous' ) }
34+ </ button >
35+ ) ;
3636
37+ const ResetButton = ( ) => {
38+ return (
39+ resetButtonAlternative ?? (
3740 < button
3841 type = "button"
39- onClick = { ( ) => onPrevious ?.( ) }
42+ onClick = { ( e ) => {
43+ resetForm ( e ) ;
44+ } }
4045 style = { { padding : '12px' } }
4146 >
42- Back
47+ { t ( 'reset' ) }
4348 </ button >
44- { resetButtonAlternative ?? (
45- < button
46- type = "button"
47- onClick = { ( e ) => {
48- resetForm ( e ) ;
49- } }
50- style = { { padding : '12px' } }
51- >
52- { t ( 'reset' ) }
53- </ button >
54- ) }
55- { ! ! onCancel &&
56- ( cancelButton ?? (
57- < button
58- type = "button"
59- onClick = { onCancel }
60- style = { { padding : '12px' } }
61- >
62- { t ( 'cancel' ) }
63- </ button >
64- ) ) }
49+ )
50+ ) ;
51+ } ;
6552
53+ const CancelButton = ( ) => {
54+ return (
55+ cancelButton ?? (
6656 < button
67- type = "submit"
57+ type = "button"
58+ onClick = { onCancel }
6859 style = { { padding : '12px' } }
69- disabled = {
70- ! rhf . formState . isValid ||
71- ( ! allowUntouchedSubmit &&
72- ! rhf . formState . isDirty &&
73- ! rhf . formState . isSubmitting )
74- }
7560 >
76- { sendLabel ?? t ( 'send ' ) }
61+ { t ( 'cancel ' ) }
7762 </ button >
63+ )
64+ ) ;
65+ } ;
66+
67+ const SubmitButton = ( ) => (
68+ < button
69+ type = "submit"
70+ style = { { padding : '12px' } }
71+ disabled = {
72+ ! rhf . formState . isValid ||
73+ ( ! allowUntouchedSubmit &&
74+ ! rhf . formState . isDirty &&
75+ ! rhf . formState . isSubmitting )
76+ }
77+ >
78+ { sendLabel ?? t ( 'send' ) }
79+ </ button >
80+ ) ;
81+
82+ return (
83+ < div style = { { height : '200px' } } >
84+ { footerComponent && < div > { footerComponent } </ div > } { ' ' }
85+ < div style = { { display : 'flex' , gap : '16px' } } >
86+ { rhf . formState . isValid &&
87+ ! allowUntouchedSubmit &&
88+ ! rhf . formState . isDirty && (
89+ < div > Het formulier is nog niet aangepast</ div >
90+ ) }
91+
92+ < PreviousButton />
93+ < ResetButton />
94+
95+ { ! ! onCancel && < CancelButton /> }
96+
97+ < SubmitButton />
7898 </ div >
7999 < div
80100 style = { {
0 commit comments