IO-743 CCC Automatic fill fixes.

This commit is contained in:
Patrick Fic
2021-03-08 15:28:28 -08:00
parent 0ed1c400c7
commit f90efd21a5
6 changed files with 35 additions and 35 deletions

View File

@@ -1,23 +1,16 @@
import { Slider } from "antd";
import React, { useEffect, useState, forwardRef } from "react";
import React, { forwardRef } from "react";
import { useTranslation } from "react-i18next";
const CourtesyCarFuelComponent = ({ value = 100, onChange }, ref) => {
const [option, setOption] = useState(value);
const CourtesyCarFuelComponent = (props, ref) => {
const { t } = useTranslation();
useEffect(() => {
if (value !== option && onChange) {
onChange(option);
}
}, [value, option, onChange]);
const marks = {
0: {
style: {
color: "#f50",
},
label: t("courtesycars.labels.fuel.empty"),
label: <strong>{t("courtesycars.labels.fuel.empty")}</strong>,
},
13: t("courtesycars.labels.fuel.18"),
25: t("courtesycars.labels.fuel.14"),
@@ -34,14 +27,6 @@ const CourtesyCarFuelComponent = ({ value = 100, onChange }, ref) => {
},
};
return (
<Slider
ref={ref}
marks={marks}
defaultValue={value}
onChange={setOption}
step={null}
/>
);
return <Slider ref={ref} marks={marks} step={null} {...props} />;
};
export default forwardRef(CourtesyCarFuelComponent);