import InputRange from "react-input-range"; import {useEffect, useState} from "react"; import {PriceRange} from "../../libs/utils"; import {isEmpty} from "radash"; /* eslint-disable-next-line */ export interface ShopAmountRangeProps { range?: PriceRange; onChange?: (range: PriceRange) => void; } export function ShopAmountRange({range = {min: 10, max: 599}, onChange}: ShopAmountRangeProps) { const [value, setValue] = useState(!isEmpty(range) ? range : {min: 10, max: 599}); useEffect(() => { setValue(!isEmpty(range) ? range : {min: 10, max: 599}); }, [range]); const inputRangeChange = (value) => setValue(value); const inputRangeChangeComplete = (value) => { if (onChange) { onChange(value); } } return (