File tree Expand file tree Collapse file tree 1 file changed +24
-19
lines changed Expand file tree Collapse file tree 1 file changed +24
-19
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,13 @@ export const FormDialog = <
112112 < div className = { clsx ( 'str-chat__dialog str-chat__dialog--form' , className ) } >
113113 < div className = 'str-chat__dialog__body' >
114114 { title && < div className = 'str-chat__dialog__title' > { title } </ div > }
115- < form autoComplete = 'off' >
115+ < form
116+ autoComplete = 'off'
117+ onSubmit = { ( e ) => {
118+ e . preventDefault ( ) ;
119+ handleSubmit ( ) ;
120+ } }
121+ >
116122 { Object . entries ( fields ) . map ( ( [ id , fieldConfig ] ) => (
117123 < div className = 'str-chat__dialog__field' key = { `dialog-field-${ id } ` } >
118124 { fieldConfig . label && (
@@ -134,26 +140,25 @@ export const FormDialog = <
134140 < FieldError text = { fieldErrors [ id ] ?. message } />
135141 </ div >
136142 ) ) }
143+ < div className = 'str-chat__dialog__controls' >
144+ < button
145+ className = 'str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel'
146+ onClick = { close }
147+ >
148+ { t < string > ( 'Cancel' ) }
149+ </ button >
150+ < button
151+ className = 'str-chat__dialog__controls-button str-chat__dialog__controls-button--submit'
152+ disabled = {
153+ Object . keys ( fieldErrors ) . length > 0 || shouldDisableSubmitButton ?.( value )
154+ }
155+ type = 'submit'
156+ >
157+ { t < string > ( 'Send' ) }
158+ </ button >
159+ </ div >
137160 </ form >
138161 </ div >
139- < div className = 'str-chat__dialog__controls' >
140- < button
141- className = 'str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel'
142- onClick = { close }
143- >
144- { t < string > ( 'Cancel' ) }
145- </ button >
146- < button
147- className = 'str-chat__dialog__controls-button str-chat__dialog__controls-button--submit'
148- disabled = {
149- Object . keys ( fieldErrors ) . length > 0 || shouldDisableSubmitButton ?.( value )
150- }
151- onClick = { handleSubmit }
152- type = 'submit'
153- >
154- { t < string > ( 'Send' ) }
155- </ button >
156- </ div >
157162 </ div >
158163 ) ;
159164} ;
You can’t perform that action at this time.
0 commit comments