summaryrefslogtreecommitdiff
path: root/src/components/Input.tsx
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2021-03-26 01:56:04 +0300
committereug-vs <eug-vs@keemail.me>2021-03-26 01:56:04 +0300
commitef742ea9b2f246f74eae74169675a331679ad41c (patch)
tree693e92f3e6c2897038875550a12bbc1191b6d5c0 /src/components/Input.tsx
parent865b41114060765308d560181f4996c0aa7a3e74 (diff)
downloadcommercel-ui-ef742ea9b2f246f74eae74169675a331679ad41c.tar.gz
feat: add strong typing where possible
Diffstat (limited to 'src/components/Input.tsx')
-rw-r--r--src/components/Input.tsx4
1 files changed, 3 insertions, 1 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}