Skip to content

Commit

Permalink
fix: popover position on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
CadenLee2 committed Jan 11, 2025
1 parent de9fa61 commit e0e2c05
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 9 additions & 0 deletions site/src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ button {
}
}

.ppc-popover.open-bottom {
margin-top: 40px;
.arrow::after,
.arrow::before {
top: -12px;
left: 7px;
}
}

.ppc-modal {
font-size: 18px;

Expand Down
6 changes: 4 additions & 2 deletions site/src/pages/RoadmapPage/Course.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import CourseQuarterIndicator from '../../component/QuarterTooltip/CourseQuarter
import CoursePopover from '../../component/CoursePopover/CoursePopover';
import OverlayTrigger from 'react-bootstrap/OverlayTrigger';
import Popover from 'react-bootstrap/Popover';
import { useIsMobile } from '../../helpers/util';

import { CourseGQLData } from '../../types/types';
import ThemeContext from '../../style/theme-context';
Expand Down Expand Up @@ -41,6 +42,7 @@ const Course: FC<CourseProps> = (props) => {
} = props;

const courseRoute = '/course/' + props.department.replace(/\s+/g, '') + props.courseNumber.replace(/\s+/g, '');
const isMobile = useIsMobile();

return (
<div className={`course ${requiredCourses ? 'invalid' : ''}`}>
Expand All @@ -54,9 +56,9 @@ const Course: FC<CourseProps> = (props) => {
</span>
<OverlayTrigger
trigger={['hover', 'focus']}
placement={openPopoverLeft ? 'left-start' : 'right-start'}
placement={isMobile ? 'bottom' : openPopoverLeft ? 'left-start' : 'right-start'}
overlay=<Popover
className={'ppc-popover' + (openPopoverLeft ? ' open-left' : '')}
className={'ppc-popover' + (isMobile ? ' open-bottom' : openPopoverLeft ? ' open-left' : '')}
id={'course-popover-' + id}
>
<CoursePopover
Expand Down

0 comments on commit e0e2c05

Please sign in to comment.