feat: created a number input component (base and formik)

fix: replace numeric TextInput fields on the Cashout, Commissions,
Cashboxes, Notifications, Operator Info and Terms & Conditions pages

fix: change the way the number format is defined on the component

fix: parameterize the number of decimal places in the in the number
input and set it's value for the current number inputs on the admin
This commit is contained in:
Liordino Neto 2020-08-05 20:12:12 -03:00 committed by Josh Harvey
parent 72a1b798f8
commit 27da8cc025
13 changed files with 195 additions and 46 deletions

View file

@ -0,0 +1,54 @@
import React, { memo } from 'react'
import NumberFormat from 'react-number-format'
import TextInput from './TextInput'
const NumberInput = memo(
({
name,
onChange,
onBlur,
value,
error,
suffix,
textAlign,
width,
// lg or sm
size,
bold,
className,
decimalPlaces,
InputProps,
...props
}) => {
return (
<NumberFormat
name={name}
onChange={onChange}
onBlur={onBlur}
value={value}
error={error}
suffix={suffix}
textAlign={textAlign}
width={width}
// lg or sm
size={size}
bold={bold}
className={className}
customInput={TextInput}
decimalScale={decimalPlaces}
onValueChange={values => {
onChange({
target: {
id: name,
value: values.floatValue
}
})
}}
{...props}
/>
)
}
)
export default NumberInput