import { FurnitureStackHeightComposer } from '@nitrots/nitro-renderer'; import { FC, useEffect, useState } from 'react'; import ReactSlider from 'react-slider'; import { LocalizeText, SendMessageComposer } from '../../../../api'; import { Button, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common'; import { useFurnitureStackHeightWidget } from '../../../../hooks'; export const FurnitureStackHeightView: FC<{}> = props => { const { objectId = -1, height = 0, maxHeight = 40, onClose = null, updateHeight = null } = useFurnitureStackHeightWidget(); const [ tempHeight, setTempHeight ] = useState(''); const updateTempHeight = (value: string) => { setTempHeight(value); const newValue = parseFloat(value); if(isNaN(newValue) || (newValue === height)) return; updateHeight(newValue); }; useEffect(() => { setTempHeight(height.toString()); }, [ height ]); if(objectId === -1) return null; return ( { LocalizeText('widget.custom.stack.height.text') }
{ state.valueNow }
} step={ 0.01 } value={ height } onChange={ event => updateHeight(event) } /> updateTempHeight(event.target.value) } />
); };