From dfe13c7c061b4b2fd6dfde8e1c3c284d574ad8f2 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 14 Mar 2021 10:21:31 +0300 Subject: refactor: wrap Input into Field --- src/components/Input.tsx | 5 ++++- src/containers/ContractorForm.tsx | 8 ++++---- src/containers/ProductForm.tsx | 6 +++--- src/index.tsx | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/components/Input.tsx b/src/components/Input.tsx index 69b97a2..896a974 100644 --- a/src/components/Input.tsx +++ b/src/components/Input.tsx @@ -1,10 +1,11 @@ import React from 'react'; +import { Field } from 'formik'; export interface Props extends React.InputHTMLAttributes { label?: string; } -const Input: React.FC = ({ label, ...props }) => { +const InputBase: React.FC = ({ label, ...props }) => { return (
@@ -18,4 +19,6 @@ const Input: React.FC = ({ label, ...props }) => { ); }; +const Input: React.FC = props => ; + export default Input; diff --git a/src/containers/ContractorForm.tsx b/src/containers/ContractorForm.tsx index a67eabe..4e83fae 100644 --- a/src/containers/ContractorForm.tsx +++ b/src/containers/ContractorForm.tsx @@ -1,14 +1,14 @@ import React from 'react'; -import { Form, Field } from 'formik'; +import { Form } from 'formik'; import Input from '../components/Input'; const ContractorForm: React.FC = () => { return (
- - - + + +
); diff --git a/src/containers/ProductForm.tsx b/src/containers/ProductForm.tsx index 4d01881..d99d3c6 100644 --- a/src/containers/ProductForm.tsx +++ b/src/containers/ProductForm.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Form, Field } from 'formik'; +import { Form } from 'formik'; import Input from '../components/Input'; @@ -7,8 +7,8 @@ const ProductForm: React.FC = () => { return (
- - + +
); diff --git a/src/index.tsx b/src/index.tsx index 932fbf3..1005a9d 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -23,7 +23,7 @@ const App: React.FC = () => ( {services.map(service => ( - + -- cgit v1.2.3