Files
nobat724_front/components/doctors/modal/Content.js
T

34 lines
854 B
JavaScript

import specialties from "@/data/specialties.json";
import Form from "./form";
function Content({ filter, setFilter, updateData }) {
const changeSpecialty = (name, value) => {
const newFilter = { ...filter, [name]: value };
if (name === "category") {
const childrenList = specialties.filter((item) => item.parent);
const filteredChildrenList = childrenList.filter(
(item) => item.parent === value.id
);
const firstChildren = filteredChildrenList[0];
newFilter.specialty = firstChildren || "";
}
setFilter(newFilter);
return newFilter;
};
return (
<div className="mt-[50px] px-[0px] md:px-[19px] lg:px-[38px] mb-[32px]">
<Form
filter={filter}
updateData={updateData}
changeSpecialty={changeSpecialty}
/>
</div>
);
}
export default Content;