diff --git a/src/components/CourseSelect/CourseSelect.css b/src/components/CourseSelect/CourseSelect.css new file mode 100644 index 0000000..538d12a --- /dev/null +++ b/src/components/CourseSelect/CourseSelect.css @@ -0,0 +1,11 @@ +.search-bar { + background-color: #f5f5f5 !important; + opacity: 1; + z-index: 10; /* Makes it on top of everything else*/ + position: sticky; + top: 10px; /* creates separation between top of screen*/ + width: 100%; + padding: 2px 4px; + display: flex; + align-items: center; +} diff --git a/src/components/CourseSelect/CourseSelect.jsx b/src/components/CourseSelect/CourseSelect.jsx index 94ba842..b66a759 100644 --- a/src/components/CourseSelect/CourseSelect.jsx +++ b/src/components/CourseSelect/CourseSelect.jsx @@ -1,37 +1,36 @@ import React from 'react'; -import InputLabel from '@mui/material/InputLabel'; -import MenuItem from '@mui/material/MenuItem'; -import FormControl from '@mui/material/FormControl'; -import Select from '@mui/material/Select'; +import Paper from '@mui/material/Paper'; +import IconButton from '@mui/material/IconButton'; +import SearchIcon from '@mui/icons-material/Search'; +import InputBase from '@mui/material/InputBase'; +import "./CourseSelect.css"; +// tips for building a search bar: https://dev.to/salehmubashar/search-bar-in-react-js-545l +// Source: https://samhalll.medium.com/implementing-a-search-bar-feature-in-react-10739d594f79 +// this explains how to pass props to a search bar comp -function CourseSelect() { - const [course, setCourse] = React.useState('All'); // change to 'All' later - - const handleChange = (event) => { - setCourse(event.target.value); - console.log(event.target.value); - }; +function CourseSelect( {searchFunc} ) { + + function onType(e) { + // console.log(e.target.value.toLowerCase()); + searchFunc(e.target.value.toLowerCase()); + } return ( -
Loading posts...
) : - (posts + { filteredposts.length === 0 ? + (No results found...
) : + (filteredposts .slice() .sort((a, b) => b.date.seconds - a.date.seconds).map((post) =>