Skip to content

Commit

Permalink
Merge branch 'main' into qa
Browse files Browse the repository at this point in the history
* main:
  disabling the submit button when the form is submitted
  • Loading branch information
EdwinGuzman committed Dec 16, 2024
2 parents 117a3f5 + ed990c7 commit f743cfd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/ReviewFormContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ function ReviewFormContainer() {

<FormRow margin-top="20px">
<DSFormField>
<RoutingLinks next={{ submit: true, text: t("button.submit") }} />
<RoutingLinks isDisabled={isLoading} next={{ submit: true, text: t("button.submit") }} />
</DSFormField>
</FormRow>
</Form>
Expand Down
8 changes: 7 additions & 1 deletion src/components/RoutingLinks.tsx/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface RoutingLinksType {
// We only want an optional "submit" property for the next prop.
// The "url" and "text" props are not needed if "submit" is passed.
next: Partial<LinkType> & { submit?: boolean };
isDisabled?: boolean;
}

/**
Expand All @@ -27,7 +28,11 @@ export interface RoutingLinksType {
* previous link is optional so it can be used on the starting page. A simple
* approach to routing until submitting forms is integrated into routing.
*/
function RoutingLinks({ previous, next }: RoutingLinksType): JSX.Element {
function RoutingLinks({
previous,
next,
isDisabled = false,
}: RoutingLinksType): JSX.Element {
const { t } = useTranslation("common");
const nextText = next.text || t("button.next");
const previousText = previous?.text || t("button.previous");
Expand Down Expand Up @@ -63,6 +68,7 @@ function RoutingLinks({ previous, next }: RoutingLinksType): JSX.Element {
) : (
<input
className={`button ${styles.next}`}
disabled={isDisabled}
type="submit"
value={nextText}
/>
Expand Down

0 comments on commit f743cfd

Please sign in to comment.