diff options
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/Input.tsx | 4 | ||||
-rw-r--r-- | src/components/ListTable.tsx | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/components/Input.tsx b/src/components/Input.tsx index a8a6f31..298d14c 100644 --- a/src/components/Input.tsx +++ b/src/components/Input.tsx @@ -3,17 +3,19 @@ import { Field } from 'formik'; export interface Props extends React.InputHTMLAttributes<HTMLInputElement> { label?: string; + ref?: React.Ref<HTMLInputElement> } const focusStyles = 'focus:outline-none focus:shadow focus:border-gray-400'; const baseStyles = 'p-2 border bg-white border-gray-300 rounded-sm'; -const InputBase: React.FC<Props> = ({ label, ...props }) => { +const InputBase: React.FC<Props> = ({ label, ref, ...props }) => { return ( <div className="m-2 mb-4 flex flex-col"> <label htmlFor={props?.name} className="mb-1 text-sm text-gray-600">{label}</label> <input id={props?.name} + ref={ref} placeholder={label} className={`${baseStyles} ${focusStyles}`} {...props} diff --git a/src/components/ListTable.tsx b/src/components/ListTable.tsx index 79e1ecd..89a2e06 100644 --- a/src/components/ListTable.tsx +++ b/src/components/ListTable.tsx @@ -7,8 +7,8 @@ export interface Field { transform?: (value: string) => JSX.Element | string; } -interface Props { - items?: any[]; +interface Props<T = any> { + items?: T[]; fields: Field[]; handleRowClick?: (index: number) => void; } |