Skip to content

Commit

Permalink
feat(envited.ascs.digital): Add file input field
Browse files Browse the repository at this point in the history
Signed-off-by: Jeroen Branje <[email protected]>
  • Loading branch information
jeroenbranje committed Feb 26, 2024
1 parent 4e0f830 commit c183cac
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion apps/envited.ascs.digital/modules/Profile/Profile.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
'use client'

import { Card, Checkbox, Checkboxes, Heading, TextField, TextareaField } from '@envited-marketplace/design-system'
import {
Card,
Checkbox,
Checkboxes,
FileField,
Heading,
TextField,
TextareaField,
} from '@envited-marketplace/design-system'
import { zodResolver } from '@hookform/resolvers/zod'
import { append, equals, includes, pathOr, prop, propOr, reject } from 'ramda'
import { FC } from 'react'
Expand All @@ -21,6 +29,7 @@ type ProfileInputs = {
name: string
description: string
logo: string
file: any
streetAddress: string
postalCode: string
addressLocality: string
Expand Down Expand Up @@ -159,6 +168,24 @@ export const Profile: FC<ProfileProps> = ({ profile, memberCategories }) => {
/>
)}
/>
<Controller
name="file"
control={control}
render={({ field: { ref, onChange, value, ...field } }) => (
<FileField
label="File"
{...field}
inputRef={ref}
value={value?.name}
onChange={event => {
if (event.target.files) {
onChange(event.target.files?.[0])
}
}}
error={pathOr('', ['file', 'message'])(errors)}
/>
)}
/>
</div>

<div className="sm:col-span-full">
Expand Down

0 comments on commit c183cac

Please sign in to comment.