From 66f01d3e234b5ac39606f4843e74080f6411e36a Mon Sep 17 00:00:00 2001 From: Alex Telischak Date: Tue, 31 Oct 2023 09:15:54 -0500 Subject: [PATCH] feat: clear search results when search field is cleared --- src/course-home/courseware-search/CoursewareSearch.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/course-home/courseware-search/CoursewareSearch.jsx b/src/course-home/courseware-search/CoursewareSearch.jsx index cfdc32e4b5..a608f654e2 100644 --- a/src/course-home/courseware-search/CoursewareSearch.jsx +++ b/src/course-home/courseware-search/CoursewareSearch.jsx @@ -31,6 +31,10 @@ const CoursewareSearch = ({ intl, ...sectionProps }) => { setResults(search.toLowerCase() !== 'lorem ipsum' ? mockedData : []); }; + const handleChange = (value) => { + if (!value?.length) { setResults(undefined); } + }; + return (
@@ -48,6 +52,7 @@ const CoursewareSearch = ({ intl, ...sectionProps }) => {

{intl.formatMessage(messages.searchModuleTitle)}