Browse Source

Adding top and bottom limits to pluviometer increase/decrease btns

master
GabrielTrettel 3 years ago
parent
commit
a8239a4be4
  1. 5
      src/app/components/forms/FormField.js

5
src/app/components/forms/FormField.js

@ -41,7 +41,6 @@ function RenderPluviometerInput({
width,
values,
}) {
console.log(name == "pluviometer");
const [fieldVal, setFieldVal] = useState(values[name]);
useEffect(() => {
@ -49,11 +48,11 @@ function RenderPluviometerInput({
}, [fieldVal]);
const increase = () => {
setFieldVal((Number(fieldVal) + 1).toString());
(Number(fieldVal) + 1) <= 999 && setFieldVal((Number(fieldVal) + 1).toString());
};
const decrease = () => {
setFieldVal((Number(fieldVal) - 1).toString());
(Number(fieldVal) - 1) >= 0 && setFieldVal((Number(fieldVal) - 1).toString());
};
return (

Loading…
Cancel
Save