IO-743 CCC Automatic fill fixes.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user