Skip to content

Commit

Permalink
change requests
Browse files Browse the repository at this point in the history
  • Loading branch information
corwintines committed Jan 31, 2025
1 parent 5c6441e commit 762c534
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 48 deletions.
53 changes: 6 additions & 47 deletions src/components/forms/PectraPGRForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,53 +167,12 @@ export const PectraPGRForm: FC = () => {

<Box display={individualOrTeam === TEAM ? 'block' : 'none'}>
<Fade in={individualOrTeam === TEAM} delay={0.25}>
<FormControl id='company-control' isRequired={individualOrTeam === TEAM} mb={8}>
<FormLabel htmlFor='company' mb={1}>
<PageText display='inline' fontSize='input'>
Name of organization or entity
</PageText>
</FormLabel>

<PageText as='small' fontSize='helpText' color='brand.helpText'>
Name of your team or entity you&apos;re submitting for. If your organization
doesn&apos;t have a formal name, just try to describe it in a few words!
</PageText>

<Input
id='company'
type='text'
bg='white'
borderRadius={0}
borderColor='brand.border'
h='56px'
color='brand.paragraph'
fontSize='input'
mt={3}
{...register('company')}
/>

{errors?.company?.type === 'required' && (
<Box mt={1}>
<PageText as='small' fontSize='helpText' color='red.500'>
Organization name is required.
</PageText>
</Box>
)}
{errors?.company?.type === 'maxLength' && (
<Box mt={1}>
<PageText as='small' fontSize='helpText' color='red.500'>
Organization name cannot exceed 255 characters.
</PageText>
</Box>
)}
{errors?.company?.type === 'validate' && (
<Box mt={1}>
<PageText as='small' fontSize='helpText' color='red.500'>
Organization name cannot contain a URL.
</PageText>
</Box>
)}
</FormControl>
<TextField
id='company'
label='Name of organization or entity'
helpText='Name of your team or entity you&apos;re submitting for. If your organization doesn&apos;t have a formal name, just try to describe it in a few words!'
isRequired
/>
</Fade>
</Box>

Expand Down
8 changes: 7 additions & 1 deletion src/components/forms/schemas/PectraPGR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ export const PectraPGRSchema = z.object({
alternativeContact: stringFieldSchema('Alternative contact info', { max: 150 }).optional(),
repeatApplicant: z.boolean(),
additionalInfo: stringFieldSchema('Additional info', { max: MAX_TEXT_AREA_LENGTH }).optional(),
})
}).refine(
data => data.individualOrTeam && data.company === "",
{
message: `Organization is required`,
path: ['company']
}
)

export type PectraPGRData = z.infer<typeof PectraPGRSchema>

0 comments on commit 762c534

Please sign in to comment.