Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Courseware Search container popover #1212

Merged
merged 11 commits into from
Oct 20, 2023
Merged

Conversation

rijuma
Copy link
Member

@rijuma rijuma commented Oct 16, 2023

Description

Ticket: KBK-42 🔒

We need a modal 🔒 to show the search components and the results.

Important

I've added @testing-library/react-hooks@^8.0.1 dependency. This allows testing standalone hooks rather than creating a testing component to use the hook. It makes it much cleaner to test.

UI changes

instructor view

480px wide 1024px wide
search-w480-instructor search-w1024-instructor

Student view

480px wide 1024px wide
search-w480-student search-w1024-student

The Design is a bit peculiar, and I couldn't match the UI using Paragon's FullscreenModal, ModalLayer nor ModalDialog.

The UI has a modal-like overlay without a backdrop that anchors just over the Course Home tabs and extends to the bottom of the page.

I've managed to create some hooks to solve the UI. Maybe this can be revisited and replaced by some of Paragon's previously mentioned components in the future.

The overlay has some placeholder text to test the inner scrolling. When the modal pops up, it scrolls to the top of the page and freeze the <body> scrolling.

Notes

I've added a prop to the slice course-home/data/slice.js. I don't see there's any unit tests on slices in the repo, maybe because they are small and simple or maybe they can be tested indirectly. I could add a slice.test.js for that extra prop if needed.

Testing Instructions:

In order to see the search button and overlay:

  • Follow the instructions to enable the waffle flags as indicated in this PR.
  • You should be able to click the search icon to popup the overlay.

Results:

You should be able to click and open the search modal when the waffle flag is enabled.

Copy link
Contributor

@schenedx schenedx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my questions and comments inline. I understand your tech decisions here. I think your choices here are sensible.

src/course-home/courseware-search/hooks.js Show resolved Hide resolved
src/course-home/courseware-search/hooks.js Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Oct 19, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (62465ec) 88.09% compared to head (6a2bd79) 88.18%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1212      +/-   ##
==========================================
+ Coverage   88.09%   88.18%   +0.08%     
==========================================
  Files         268      270       +2     
  Lines        4537     4587      +50     
  Branches     1145     1151       +6     
==========================================
+ Hits         3997     4045      +48     
- Misses        526      528       +2     
  Partials       14       14              
Files Coverage Δ
...course-home/courseware-search/CoursewareSearch.jsx 100.00% <100.00%> (ø)
...-home/courseware-search/CoursewareSearchToggle.jsx 100.00% <100.00%> (ø)
src/course-home/courseware-search/hooks.js 100.00% <100.00%> (ø)
src/course-home/courseware-search/messages.js 100.00% <ø> (ø)
src/course-tabs/CourseTabsNavigation.jsx 100.00% <100.00%> (ø)
src/course-home/data/slice.js 93.10% <0.00%> (-6.90%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rijuma rijuma marked this pull request as ready for review October 19, 2023 13:03
@rijuma rijuma changed the title Added Courseware Search container popover (WIP) Added Courseware Search container popover Oct 19, 2023
Copy link
Contributor

@schenedx schenedx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor feedback and a learning question. Good job 👍

src/course-home/courseware-search/hooks.test.jsx Outdated Show resolved Hide resolved
@rijuma rijuma merged commit cbb419c into master Oct 20, 2023
5 checks passed
@rijuma rijuma deleted the rijuma/courseware-search-modal branch October 20, 2023 14:33
CefBoud pushed a commit to open-craft/frontend-app-learning that referenced this pull request Nov 5, 2023
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants