diff --git a/src/components/Form/TextArea/index.ts b/src/components/Form/TextArea/index.ts new file mode 100644 index 0000000..9f93c0d --- /dev/null +++ b/src/components/Form/TextArea/index.ts @@ -0,0 +1 @@ +export { TextArea } from './textarea'; diff --git a/src/components/Form/TextArea/textarea.tsx b/src/components/Form/TextArea/textarea.tsx new file mode 100644 index 0000000..2dfa188 --- /dev/null +++ b/src/components/Form/TextArea/textarea.tsx @@ -0,0 +1,43 @@ +import React from 'react'; +import { useController } from 'react-hook-form'; + +/* eslint-disable react/react-in-jsx-scope */ +export const TextArea = ({ control, name, label, required, ...props }: TextAreaProps) => { + const { + field, + // fieldState: { invalid, isTouched, isDirty }, + // formState: { touchedFields, dirtyFields }, + } = useController({ + name, + control, + rules: { required }, + defaultValue: '', + }); + + return ( + <> + {label && ( + + )} + - - ); - }; + const { fields } = useFieldArray({ + control, + name: 'appRoles', + }); const handleSave = async () => { - // try { - // if (userId) { - // await handleSubmit((data) => editUserById(data))(); - // } else { - // await handleSubmit((data) => createNewUser(data))(); - // } - // } catch (e: any) { - // // Continue - // } - - onUpload(); + try { + await handleSubmit((data) => createUsers(data))(); + } catch (e: any) { + // Continue + } onClose(); }; @@ -79,46 +34,87 @@ export const MultipleUsersModal = ({ open, onClose, onUpload }: MultipleUsersMod onClose(); }; + const renderUsersCsvDataInput = () => { + return ( +
+