diff --git a/src/common/util/show-toast.tsx b/src/common/util/show-toast.tsx index 351a985..0ab0f3c 100644 --- a/src/common/util/show-toast.tsx +++ b/src/common/util/show-toast.tsx @@ -9,7 +9,7 @@ export enum ToastType { Error = 'error', } -export const showToast = (text: string, type?: ToastType) => { +export const showToast = (text: string, type?: ToastType, duration?: number) => { switch (type) { case ToastType.Error: toast.custom( @@ -47,7 +47,7 @@ export const showToast = (text: string, type?: ToastType) => { ), - { position: 'top-right' }, + { position: 'top-right', duration }, ); break; default: @@ -86,7 +86,7 @@ export const showToast = (text: string, type?: ToastType) => { ), - { position: 'top-right' }, + { position: 'top-right', duration }, ); } }; diff --git a/src/components/Form/Select/Select.tsx b/src/components/Form/Select/Select.tsx index aad51fa..06a5322 100644 --- a/src/components/Form/Select/Select.tsx +++ b/src/components/Form/Select/Select.tsx @@ -26,7 +26,7 @@ export const Select = ({ control, name, label, options, disabled = false }: Sele value={field.value ? field.value : ''} // input value name={name} // send down the input name ref={field.ref} // send input ref, so we can focus on input when error appear - className="shadow-sm focus:ring-primary-500 focus:border-primary-500 block w-full sm:text-sm border-gray-300 rounded-md" + className="block shadow-sm focus:ring-primary-500 focus:border-primary-500 block w-full sm:text-sm border-gray-300 rounded-md" disabled={disabled} > {options?.map((option) => ( 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 && ( + + )} +