diff --git a/src/components/Dropdown.tsx b/src/components/Dropdown.tsx index 0160e2b..84df6aa 100644 --- a/src/components/Dropdown.tsx +++ b/src/components/Dropdown.tsx @@ -60,19 +60,30 @@ interface DropdownProps { export const Dropdown = ({ clearInput, handleClearInput }: DropdownProps) => { const classes = useStyles(); - const [open, setOpen] = React.useState(false); - const [input, setInput] = useState(''); + const [open, setOpen] = useState(false); + const [input, setInput] = useState(''); //courses - choosenCourses const [filteredCourses, setFilteredCourses] = useState>([]); + const { courses, basket, addToBasket } = useContext(coursesContext)!; useEffect(() => { const filterCourses = (input: string) => { const choosenCoursesNames = basket.map(({ name }) => name.trim()); const filteredCourses = courses.filter( - ({ name }) => name.toLowerCase().includes(input.toLowerCase()) && !choosenCoursesNames.includes(name), + ({ name }) => + name + .toLowerCase() + .normalize('NFD') + .replace(/[\u0300-\u036f]/g, '') + .includes( + input + .toLowerCase() + .normalize('NFD') + .replace(/[\u0300-\u036f]/g, ''), + ) && !choosenCoursesNames.includes(name), ); setFilteredCourses(filteredCourses); }; diff --git a/src/components/Topbar.tsx b/src/components/Topbar.tsx index 1b2f0f5..42794bb 100644 --- a/src/components/Topbar.tsx +++ b/src/components/Topbar.tsx @@ -107,7 +107,7 @@ export default function ({ handleTransfer }: TopbarProps) { - + {/* */}