This commit is contained in:
Sacha Weatherstone
2021-08-15 18:27:33 +10:00
parent 2940791b9e
commit 29fcc8051c
46 changed files with 1143 additions and 1531 deletions
-38
View File
@@ -1,38 +0,0 @@
import React from 'react';
import type { FieldValues, UseControllerProps } from 'react-hook-form';
import { Controller } from 'react-hook-form';
import ReactSelect from 'react-select';
interface SelectProps<T> extends UseControllerProps<T> {
label: string;
options: {
value: string;
label: string;
}[];
}
export const Select = <T extends FieldValues>({
name,
control,
label,
options,
}: SelectProps<T>): JSX.Element => {
return (
<Controller
name={name}
control={control}
rules={{
required: 'This is required',
}}
render={({ field: { onChange, value, name } }) => (
<div className="space-y-1">
<span className="block text-sm font-medium dark:text-white">
{label}
</span>
<ReactSelect options={options} />
</div>
)}
/>
);
};