-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform-component.tsx
More file actions
43 lines (41 loc) · 1.11 KB
/
form-component.tsx
File metadata and controls
43 lines (41 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import {
Checkbox,
FileAttachment,
Input,
SingleSelect,
Textarea,
} from '@/components'
import type { FormColumn } from '@/types'
export const FormComponent = (column: FormColumn): React.ReactNode => {
switch (column.uidt) {
case 'SingleLineText':
return <Input type='text' name={column.name} required={column.required} />
case 'PhoneNumber':
return (
<Input
type='tel'
id={column.name}
name={column.name}
required={column.required}
/>
)
case 'Number':
return (
<Input type='number' name={column.name} required={column.required} />
)
case 'Checkbox':
return <Checkbox column={column} />
case 'SingleSelect':
return <SingleSelect column={column} />
case 'LongText':
return <Textarea column={column} />
case 'Attachment':
return <FileAttachment name={column.name} required={column.required} />
default:
return (
<p className='text-body-2 font-light italic text-red-600'>
This system currently does not support {column.uidt}.
</p>
)
}
}