fix(striker-ui): display message only when submit is allowed in GateForm

main
Tsu-ba-me 2 years ago
parent 184a5962fa
commit c5d349bc92
  1. 7
      striker-ui/components/GateForm.tsx

@ -109,6 +109,10 @@ const GateForm = forwardRef<GateFormForwardedRefContent, GateFormProps>(
[], [],
); );
const messagesGroupSxDisplay = useMemo(
() => (isAllowSubmit ? undefined : 'none'),
[isAllowSubmit],
);
const identifierInputTestBatch = useMemo( const identifierInputTestBatch = useMemo(
() => () =>
overwriteIdentifierInputTestBatch?.call( overwriteIdentifierInputTestBatch?.call(
@ -183,7 +187,7 @@ const GateForm = forwardRef<GateFormForwardedRefContent, GateFormProps>(
) : ( ) : (
<FlexBox row sx={{ justifyContent: 'flex-end' }}> <FlexBox row sx={{ justifyContent: 'flex-end' }}>
<ContainedButton <ContainedButton
disabled={isInputIdentifierValid && isInputPassphraseValid} disabled={!isInputIdentifierValid || !isInputPassphraseValid}
onClick={submitHandler} onClick={submitHandler}
> >
{submitLabel} {submitLabel}
@ -301,6 +305,7 @@ const GateForm = forwardRef<GateFormForwardedRefContent, GateFormProps>(
'credential-message-group': { 'credential-message-group': {
children: <MessageGroup count={1} ref={messageGroupRef} />, children: <MessageGroup count={1} ref={messageGroupRef} />,
sm: 2, sm: 2,
sx: { display: messagesGroupSxDisplay },
}, },
'credential-submit': submitGrid, 'credential-submit': submitGrid,
}} }}

Loading…
Cancel
Save