-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: merge warning into course popover * feat: replace info icon with warning icon if issue * feat: make popover styles conform more to figma * feat: increase popover arrow size * fix: correct popover directions with arrows * fix: popover sizing details * feat: popover arrow shadow * refactor: move course popover to new component * fix: course popover line heights * fix: course popover props interface * fix: popover position on mobile * refactor: remove separate popover position classes * Adjust styles of tooltip * fix tooltips in other directions * fix: bottom popover arrow color * fix: course popover position issue --------- Co-authored-by: Cadecraft <[email protected]> Co-authored-by: Awesome-E <[email protected]>
- Loading branch information
1 parent
c4d9029
commit 9a92bd3
Showing
7 changed files
with
234 additions
and
71 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
.course-popover { | ||
line-height: normal; | ||
|
||
.popover-name { | ||
font-weight: bold; | ||
color: var(--text-dark); | ||
font-size: 16px; | ||
height: 21px; | ||
margin-top: -2px; | ||
} | ||
|
||
.popover-subtitle { | ||
font-weight: bold; | ||
} | ||
|
||
.popover-units { | ||
font-weight: normal; | ||
} | ||
|
||
.popover-description { | ||
font-size: 14px; | ||
padding-top: 12px; | ||
line-height: 17px; | ||
} | ||
|
||
.popover-detail { | ||
padding-top: 12px; | ||
} | ||
|
||
.popover-detail-prefix { | ||
font-weight: bold; | ||
} | ||
|
||
.popover-detail-warning { | ||
font-size: 14px; | ||
color: #ce0000; | ||
gap: 5px; | ||
|
||
.popover-detail-warning-icon { | ||
margin-bottom: 4px; | ||
margin-right: 4px; | ||
font-size: 16px; | ||
} | ||
} | ||
|
||
.popover-detail-italics { | ||
padding-top: 6px; | ||
font-weight: 400; | ||
font-size: 12px; | ||
font-style: italic; | ||
color: var(--petr-gray); | ||
} | ||
} | ||
|
||
[data-theme='dark'] { | ||
.popover-detail-warning { | ||
color: red; | ||
} | ||
.popover-detail-italics { | ||
color: var(--petr-gray); | ||
} | ||
} |
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,68 @@ | ||
import { FC } from 'react'; | ||
import './CoursePopover.scss'; | ||
import { ExclamationTriangle } from 'react-bootstrap-icons'; | ||
import Popover from 'react-bootstrap/Popover'; | ||
|
||
interface CoursePopoverProps { | ||
department: string; | ||
courseNumber: string; | ||
title: string; | ||
minUnits: number; | ||
maxUnits: number; | ||
description: string; | ||
prerequisiteText: string; | ||
corequisites: string; | ||
requiredCourses?: string[]; | ||
} | ||
|
||
const CoursePopover: FC<CoursePopoverProps> = (props) => { | ||
const { | ||
department, | ||
courseNumber, | ||
title, | ||
minUnits, | ||
maxUnits, | ||
description, | ||
prerequisiteText, | ||
corequisites, | ||
requiredCourses, | ||
} = props; | ||
|
||
return ( | ||
<Popover.Content className="course-popover"> | ||
<div className="popover-name"> | ||
{department + ' ' + courseNumber + ' '} | ||
<span className="popover-units">({minUnits === maxUnits ? minUnits : `${minUnits}-${maxUnits}`} units)</span> | ||
</div> | ||
<div className="popover-description"> | ||
<span className="popover-subtitle">{title + ':'}</span> | ||
<br /> | ||
{description} | ||
</div> | ||
{prerequisiteText && ( | ||
<div className="popover-detail"> | ||
<span className="popover-detail-prefix">Prerequisites:</span> {prerequisiteText} | ||
</div> | ||
)} | ||
{corequisites && ( | ||
<div className="popover-detail"> | ||
<span className="popover-detail-prefix">Corequisites:</span> {corequisites} | ||
</div> | ||
)} | ||
{requiredCourses && ( | ||
<div className="popover-detail"> | ||
<div className="popover-detail-warning"> | ||
<ExclamationTriangle className="popover-detail-warning-icon" /> | ||
Prerequisite{requiredCourses?.length > 1 ? 's' : ''} Not Met: {requiredCourses?.join(', ')} | ||
</div> | ||
<div className="popover-detail-italics"> | ||
Already completed? Click "Transfer Credits" at the top of the roadmap viewer to add{' '} | ||
{requiredCourses?.length > 1 ? 'these prerequisites' : 'this prerequisite'}. | ||
</div> | ||
</div> | ||
)} | ||
</Popover.Content> | ||
); | ||
}; | ||
|
||
export default CoursePopover; |
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
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