diff --git a/src/components/FormInput/Input.js b/src/components/AnimatedInput/Input.js similarity index 100% rename from src/components/FormInput/Input.js rename to src/components/AnimatedInput/Input.js diff --git a/src/components/FormInput/fixNumbers.js b/src/components/AnimatedInput/fixNumbers.js similarity index 100% rename from src/components/FormInput/fixNumbers.js rename to src/components/AnimatedInput/fixNumbers.js diff --git a/src/components/FormInput/index.js b/src/components/FormInput/index.js index 9ea3be8..8311252 100644 --- a/src/components/FormInput/index.js +++ b/src/components/FormInput/index.js @@ -1,15 +1,15 @@ import React, { useState } from "react"; import { useForm } from "react-hook-form"; -import DateRangePicker from "../DateRangePicker"; -import Input from "./Input"; +import DateRangePicker from "../DateRangePicker"; +import Input from "../AnimatedInput/Input"; const FormInput = () => { const { register, getValues } = useForm(); const [selectedInput, setSelectedInput] = useState(false); return ( -
+
{ - const { register, getValues } = useForm(); - - return ( -
-
-
- - -
-
- - -
-
- - -
-
-
- ); + return
TestComponentNew
; }; export default TestComponentNew; diff --git a/src/components/TestComponentNew/input.js b/src/components/TestComponentNew/input.js deleted file mode 100644 index 6cd516e..0000000 --- a/src/components/TestComponentNew/input.js +++ /dev/null @@ -1,66 +0,0 @@ -import fixNumbers from "./fixNumbers"; -import { useState } from "react"; - -const Input = ({ - defaultValue, - set, - label, - className, - type, - maxLength, - max, - min, - register, -}) => { - const [value, setValue] = useState(defaultValue); - return ( -
-
- {label} -
- {type !== "textarea" ? ( - setValue(e.target.value)} - inputMode={type === "number" ? "numeric" : ""} - onInput={(e) => { - let value = e.target.value; - if (type === "number") - value = fixNumbers(value).replace(/[^\d.-]/g, ""); - if (maxLength && value.length > maxLength) - value = value.slice(0, maxLength); - if (!isNaN(max) && +e.target.value > max) value = max; - if (!isNaN(min) && +e.target.value < min) value = min; - e.target.value = value; - }} - /> - ) : ( - - )} -
- ); -}; -export default Input;