diff --git a/src/Components/Input/Number/index.jsx b/src/Components/Input/Number/index.jsx index 6764f84fe..d121aff88 100644 --- a/src/Components/Input/Number/index.jsx +++ b/src/Components/Input/Number/index.jsx @@ -4,9 +4,12 @@ import React, { useState, } from 'react'; -import Info from '../Info'; +import FormControl from '@mui/material/FormControl'; +import Grid from '@mui/material/Grid'; +import Input from '@mui/material/Input'; +import Typography from '@mui/material/Typography'; -import './style.scss'; +import Info from '../Info'; function Number({ name, @@ -22,7 +25,8 @@ function Number({ hint, disabled, }) { - const [displayValue, setDisplayValue] = useState(value * factor + offset); + const calculated = Math.round(value * factor + offset); + const [displayValue, setDisplayValue] = useState(calculated); const updateValue = useCallback(() => { let value = displayValue; @@ -36,11 +40,12 @@ function Number({ value = (max - offset) / factor; } - value = Math.round(value); if(isNaN(value)) { value = (min - offset) / factor; } + value = Math.round(value); + setDisplayValue(value * factor + offset); onChange(name, value); }, [displayValue, offset, factor, min, max, onChange, name]); @@ -51,11 +56,22 @@ function Number({ }, []); return ( -
- -
+ + + + + {label} + + + + + + ); } diff --git a/src/Components/Input/Number/style.scss b/src/Components/Input/Number/style.scss deleted file mode 100644 index bc4008655..000000000 --- a/src/Components/Input/Number/style.scss +++ /dev/null @@ -1,22 +0,0 @@ -.number-text { - margin-top: 5px; - margin-bottom: 5px; - width: 100%; - - &:last-child { - border-bottom: none; - padding-bottom: 0px; - margin-bottom: 0px; - } - - .disabled { - width: 43px; - padding: 0px 5px; - background-color: #ececec; - } - - span.label { - margin-left: 3px; - float: left; - } -}