-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Courseware Search container popover UI (#1212)
* feat: Added Courseware Search container popover * chore: Added unit tests for CoursewareSearch and CoursewareSearchToggle * chore: Updated unit test for CourseTabsNavigation * chore: Partial coverage on Courseware Search Hooks * chore: Finished Courseware Search Hooks unit testing * fix: Fixed an overlook that caused a conditional hook * fix: Reduced bounce timeout on scroll/resize to 100ms * chore: Updated snapshots * chore: Moved @testing-library/react-hooks dep to DEV * chore: Minor adjustments on unit tests * chore: Fixed test issue
- Loading branch information
Showing
16 changed files
with
674 additions
and
88 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/course-home/courseware-search/CoursewareSearchToggle.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from 'react'; | ||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; | ||
import { Button, Icon } from '@edx/paragon'; | ||
import { Search } from '@edx/paragon/icons'; | ||
import { useDispatch } from 'react-redux'; | ||
import { setShowSearch } from '../data/slice'; | ||
import messages from './messages'; | ||
import { useCoursewareSearchFeatureFlag } from './hooks'; | ||
|
||
const CoursewareSearchToggle = ({ | ||
intl, | ||
}) => { | ||
const dispatch = useDispatch(); | ||
const enabled = useCoursewareSearchFeatureFlag(); | ||
|
||
if (!enabled) { return null; } | ||
|
||
return ( | ||
<div className="courseware-searc-toggle"> | ||
<Button | ||
variant="tertiary" | ||
size="sm" | ||
className="p-1 mt-2 mr-2 rounded-lg" | ||
aria-label={intl.formatMessage(messages.searchOpenAction)} | ||
onClick={() => dispatch(setShowSearch(true))} | ||
data-testid="courseware-search-open-button" | ||
> | ||
<Icon src={Search} /> | ||
</Button> | ||
</div> | ||
); | ||
}; | ||
|
||
CoursewareSearchToggle.propTypes = { | ||
intl: intlShape.isRequired, | ||
}; | ||
|
||
export default injectIntl(CoursewareSearchToggle); |
Oops, something went wrong.