normalize polish signs
This commit is contained in:
parent
148156fdca
commit
770a5f09d3
@ -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<string>('');
|
||||
const [open, setOpen] = useState(false);
|
||||
const [input, setInput] = useState('');
|
||||
|
||||
//courses - choosenCourses
|
||||
const [filteredCourses, setFilteredCourses] = useState<Array<Course>>([]);
|
||||
|
||||
|
||||
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);
|
||||
};
|
||||
|
@ -107,7 +107,7 @@ export default function ({ handleTransfer }: TopbarProps) {
|
||||
<TopbarInputIconStyled alt="close" src={CloseIcon} onClick={handleClearInput} />
|
||||
</TopbarInputStyled>
|
||||
<TopbarIconBox>
|
||||
<TopbarIcon alt="transfer" src={Transfer} onClick={handleTransfer} />
|
||||
{/* <TopbarIcon alt="transfer" src={Transfer} onClick={handleTransfer} /> */}
|
||||
<TopbarIcon alt="change_language" src={isPolish ? UK : PL} onClick={onLangChange} />
|
||||
<TopbarIcon alt="profile" src={User} onClick={handleProfile} />
|
||||
<Profile anchorEl={anchorEl} handleClose={handleClose} />
|
||||
|
Loading…
Reference in New Issue
Block a user