| 1 |
import React, { Fragment } from 'react'; |
| 2 |
|
| 3 |
const PropertyNumber= (props) => { |
| 4 |
const suffix = props.property.hasOwnProperty('suffix') ? props.property.suffix : ''; |
| 5 |
const value = suffix ? props.value.replace(suffix, '') : props.value; |
| 6 |
|
| 7 |
return ( |
| 8 |
<Fragment> |
| 9 |
<input |
| 10 |
className="wpupg-template-property-input" |
| 11 |
type="number" |
| 12 |
value={value} |
| 13 |
onChange={(e) => { |
| 14 |
const newValue = `${e.target.value}${suffix}`; |
| 15 |
return props.onValueChange(newValue); |
| 16 |
}} |
| 17 |
/> |
| 18 |
{ |
| 19 |
suffix |
| 20 |
&& |
| 21 |
<span className="wpupg-template-property-number-suffix"> { suffix }</span> |
| 22 |
} |
| 23 |
</Fragment> |
| 24 |
); |
| 25 |
} |
| 26 |
|
| 27 |
export default PropertyNumber; |