diff --git a/src/components/Home/StudentFilter.jsx b/src/components/Home/StudentFilter.jsx index ab2fb9e..46a0fdc 100644 --- a/src/components/Home/StudentFilter.jsx +++ b/src/components/Home/StudentFilter.jsx @@ -1,5 +1,6 @@ import React from 'react'; +import useCourses from '@data/useCourses'; import useMajors from '@data/useMajors'; import { Box, @@ -16,10 +17,13 @@ import { export default function StudentFilter({ selectedMajors, setSelectedMajors, + selectedCourses, + setSelectedCourses, selectedYears, setSelectedYears, }) { const majorsList = useMajors(); + const coursesList = useCourses(); return ( @@ -36,7 +40,28 @@ export default function StudentFilter({ sx={{ flex: 1, mb: 2, minWidth: 200, maxWidth: '100%' }} /> - {/* 2. Year filter */} + {/* 2. Course filter */} + option} + value={selectedCourses} + onChange={(event, newValue) => setSelectedCourses(newValue)} + renderInput={(params) => ( + + )} + filterOptions={(options, { inputValue }) => { + // Convert inputValue to lowercase for case-insensitive matching + const lowercasedInput = inputValue.toLowerCase(); + + // Only include options that start with the input + return options.filter((option) => option.toLowerCase().startsWith(lowercasedInput)); + }} + sx={{ flex: 1, mb: 2, minWidth: 200, maxWidth: '100%' }} + freeSolo + /> + + {/* 3. Year filter */} Filter by Year(s)