diff --git a/src/components/GradeFilter/index.tsx b/src/components/GradeFilter/index.tsx index e17fb83..9d0adeb 100644 --- a/src/components/GradeFilter/index.tsx +++ b/src/components/GradeFilter/index.tsx @@ -6,15 +6,20 @@ import "./index.scss"; import dropdown from "../../assets/icons/dropdown.png"; -function GradeFilter({selectedGrade, gradeFilter, grades}: any) { +function GradeFilter({selectedGrade, gradeFilter, grades, gradeDropdown, setGradeDropdown}: any) { const [arrowTop, setArrowTop] = useState(false); useEffect(() => { - setArrowTop(false); + setGradeDropdown(false); }, [selectedGrade]); const mobileList = useRef(null); + const setDropdown = (e : any) => { + e.stopPropagation(); + setGradeDropdown(!gradeDropdown); + } + return (

@@ -23,7 +28,7 @@ function GradeFilter({selectedGrade, gradeFilter, grades}: any) {

setArrowTop(!arrowTop)} + onClick={(e : any) => setDropdown(e)} > {selectedGrade ? (

{grades[selectedGrade - 1].name}

@@ -33,9 +38,10 @@ function GradeFilter({selectedGrade, gradeFilter, grades}: any) {
- {arrowTop ? ( + {gradeDropdown ? (