-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement preliminary validation logic (#48)
* In-progress, looking for an old commit or stash... * Handle errors in the prompt response * Add a "submission-confirmation" prompt type, and display when a form's session is complete. "Complete" is defined as every values in the form is valid. TODO: implement the validation with a zod parser. * Wire input validation up, using zod. * To make validation interactive on the client-side, update the prompt in response to input changes. * Fully wire up the validation so it works with the UI and form submission. TODO: implement backend session storage and improve the shape of the form service interface * Fix missed tests
- Loading branch information
1 parent
5057d00
commit 8595414
Showing
33 changed files
with
960 additions
and
712 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
37 changes: 37 additions & 0 deletions
37
packages/design/src/Form/PromptSegment/SubmissionConfirmation/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from 'react'; | ||
|
||
import { type SubmissionConfirmationPrompt } from '@atj/forms'; | ||
|
||
export type SubmissionConfirmationProps = { | ||
prompt: SubmissionConfirmationPrompt; | ||
}; | ||
|
||
export default function SubmissionConfirmation({ | ||
prompt, | ||
}: SubmissionConfirmationProps) { | ||
return ( | ||
<> | ||
<legend className="usa-legend usa-legend--large"> | ||
Submission confirmation | ||
</legend> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Field</th> | ||
<th>Value</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{prompt.table.map((row, index) => { | ||
return ( | ||
<tr key={index}> | ||
<td>{row.label}</td> | ||
<td>{row.value}</td> | ||
</tr> | ||
); | ||
})} | ||
</tbody> | ||
</table> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.