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 @@ -107,7 +107,13 @@ export const FormDialog = <
107107 < div className = { clsx ( 'str-chat__dialog str-chat__dialog--form' , className ) } >
108108 < div className = 'str-chat__dialog__body' >
109109 { title && < div className = 'str-chat__dialog__title' > { title } </ div > }
110- < form autoComplete = 'off' >
110+ < form
111+ autoComplete = 'off'
112+ onSubmit = { ( e ) => {
113+ e . preventDefault ( ) ;
114+ handleSubmit ( ) ;
115+ } }
116+ >
111117 { Object . entries ( fields ) . map ( ( [ id , fieldConfig ] ) => (
112118 < div className = 'str-chat__dialog__field' key = { `dialog-field-${ id } ` } >
113119 { fieldConfig . label && (
@@ -129,26 +135,25 @@ export const FormDialog = <
129135 < FieldError text = { fieldErrors [ id ] ?. message } />
130136 </ div >
131137 ) ) }
138+ < div className = 'str-chat__dialog__controls' >
139+ < button
140+ className = 'str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel'
141+ onClick = { close }
142+ >
143+ { t < string > ( 'Cancel' ) }
144+ </ button >
145+ < button
146+ className = 'str-chat__dialog__controls-button str-chat__dialog__controls-button--submit'
147+ disabled = {
148+ Object . keys ( fieldErrors ) . length > 0 || shouldDisableSubmitButton ?.( value )
149+ }
150+ type = 'submit'
151+ >
152+ { t < string > ( 'Send' ) }
153+ </ button >
154+ </ div >
132155 </ form >
133156 </ div >
134- < div className = 'str-chat__dialog__controls' >
135- < button
136- className = 'str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel'
137- onClick = { close }
138- >
139- { t < string > ( 'Cancel' ) }
140- </ button >
141- < button
142- className = 'str-chat__dialog__controls-button str-chat__dialog__controls-button--submit'
143- disabled = {
144- Object . keys ( fieldErrors ) . length > 0 || shouldDisableSubmitButton ?.( value )
145- }
146- onClick = { handleSubmit }
147- type = 'submit'
148- >
149- { t < string > ( 'Send' ) }
150- </ button >
151- </ div >
152157 </ div >
153158 ) ;
154159} ;
You can’t perform that action at this time.
0 commit comments