Skip to content

Commit

Permalink
Update rules for bends
Browse files Browse the repository at this point in the history
  • Loading branch information
natesawant committed Feb 21, 2024
1 parent 8be8257 commit 23687cf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions frontend/src/pages/InputForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function InputForm() {
type='number'
{...field}
error={errors.length?.value !== undefined}
label={errors.length?.value ? 'Please enter a positive number' : ''}
onChange={(event) => field.onChange(+event.target.value)}
fullWidth
></TextField>
Expand All @@ -96,6 +97,7 @@ function InputForm() {
key='length-unit'
{...field}
error={errors.length?.unit !== undefined}
label={errors.length?.unit ? 'Please select a valid option' : ''}
fullWidth
>
<MenuItem value={MeasurementUnit.inches}>Inches</MenuItem>
Expand All @@ -122,6 +124,7 @@ function InputForm() {
key='bend-count'
type='number'
error={errors.bendCount !== undefined}
label={errors.bendCount ? 'Please enter a positive integer' : ''}
{...field}
fullWidth
onChange={(event) => field.onChange(+event.target.value)}
Expand Down Expand Up @@ -180,13 +183,15 @@ function InputForm() {
name={`bends.${bendIndex}.${value.key}.value`}
rules={{
required: true,
min: 0
}}
render={({ field }) => (
<TextField placeholder={'0'}
key={`bends-${bendIndex}-${value.key}`}
fullWidth
variant="filled"
type='number'
error={errors.bends?.[bendIndex]?.[value.key] !== undefined}
{...field}
onChange={(event) => field.onChange(+event.target.value)}
></TextField>
Expand Down

0 comments on commit 23687cf

Please sign in to comment.