36 lines
911 B
JavaScript
36 lines
911 B
JavaScript
import { Select } from "antd";
|
|
import React, { forwardRef, useEffect, useState } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
const { Option } = Select;
|
|
|
|
const CourtesyCarReadinessComponent = ({ value, onChange }, ref) => {
|
|
const [option, setOption] = useState(value);
|
|
const { t } = useTranslation();
|
|
|
|
useEffect(() => {
|
|
if (value !== option && onChange) {
|
|
onChange(option);
|
|
}
|
|
}, [value, option, onChange]);
|
|
|
|
return (
|
|
<Select
|
|
allowClear
|
|
ref={ref}
|
|
value={option}
|
|
style={{
|
|
width: 100,
|
|
}}
|
|
onChange={setOption}
|
|
>
|
|
<Option value="courtesycars.readiness.ready">
|
|
{t("courtesycars.readiness.ready")}
|
|
</Option>
|
|
<Option value="courtesycars.readiness.notready">
|
|
{t("courtesycars.readiness.notready")}
|
|
</Option>
|
|
</Select>
|
|
);
|
|
};
|
|
export default forwardRef(CourtesyCarReadinessComponent);
|