-
Notifications
You must be signed in to change notification settings - Fork 14
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
Merge course popovers #551
base: main
Are you sure you want to change the base?
Conversation
…to merge-course-popovers update from main
…to merge-course-popovers update from main
site/src/App.scss
Outdated
box-shadow: 0 0 16px 0 rgba(0, 0, 0, 0.35); | ||
max-width: 375px; | ||
margin-left: 16px; | ||
top: -26px !important; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on research into the Boostrap Popover
, it seems this is needed, but using !important
is typically not good practice
Tried using margin-top
, different position
s, transform: translate
(these do nothing)
Tried:
div.ppc-popover {
/* ... */
top: -26px;
}
(this does nothing)
Tried:
.ppc-popover {
/* ... */
&::before {
display: block;
content: "";
margin-top: -26px;
}
}
This results in partial success, but does not render the shadow or border correctly on the top portion (especially visible in light mode)--the shadow is vertically too short, so it would take multiple overlapping and offset shadows to cover that portion
Suggestions would be appreciated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah it looks like it was styled on the element itself, so !important
is the only way to override that
<OverlayTrigger | ||
trigger={['hover', 'focus']} | ||
placement={isMobile ? 'bottom' : openPopoverLeft ? 'left-start' : 'right-start'} | ||
overlay=<Popover className="ppc-popover" id={'course-popover-' + id}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When extracting CoursePopover
into its own component, I originally included the top-level Popover
tag in it. However, because of the ways OverlayTrigger
interacts with whatever is passed into overlay
to provide the placement direction and location, it failed to pass that information. This led to the popover always being located in the top-left corner of the page.
There is little documentation on how the OverlayTrigger works with what's passed into overlay
, and all the examples I found put the component in the same file (often just inline), like it was before in this file. Solutions I found online included wrapping the component in a div
(overlay=<div><MyComponent /></div>
), or trying to pass all of the props to the component using the spread operator, but that messed up the positioning of the Popover further.
I didn't want to overcomplicate things, so this led to putting the top-level Popover
in this file, then letting the CoursePopover
represent its body and actual contents. That said, this is a bit unintuitive in terms of usage, and ideally CoursePopover
should encapsulate the entire Popover
functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. to be honest, I think we might just want to create our own custom popover component, especially if we're going to need to be able to click on things inside the popover (bookmark button) without it closing on its own
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrapped a couple elements in braces {}
and tweaked some styles. just check it, make any fixes, and feel free to merge
After updating from main (the Roadmap Search Redesign), there is now a problem with the popover positions, currently unpredictable, and it should be resolved before this is merged because it can severely impact the usage of the website. Description
Steps to replicate (potentially):
Notes
|
Merge the course info popover and the missing prerequisites popover into one, merge their icons, refactor this into a new component, update styles
Description
Currently, there are two popovers for a course: the course information popover, and the warning popover for missing prerequisites.
Course
where we want the popover to open to the left, the propopenPopoverLeft={true}
must be explicitly set, because Boostrap'sauto
placement was broken and it often went off screen. IfopenPopoverLeft
is not included, the popover will open to the right.CoursePopover
ppc-popover
is now an available CSS class inApp.scss
for such popovers (React Bootstrap popovers)Screenshots
Before:
After:
Dark mode, and opening on the left side (from the roadmap search) (note that the hoverable icon looks small due to the quarter offerings and small width, which will be fixed later when the Roadmap Search Redesign PR is merged):
Opening on the bottom in mobile:
Test Plan
Check the above changes in the staging instance:
Verify successful deployment
Issues
Closes #526