Skip to content

Design QA #2308

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

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontends/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@emotion/styled": "^11.11.0",
"@mitodl/course-search-utils": "3.3.2",
"@mitodl/mitxonline-api-axios": "^2025.6.3",
"@mitodl/smoot-design": "0.0.0-0a23f44",
"@mitodl/smoot-design": "^6.10.0",
"@next/bundle-analyzer": "^14.2.15",
"@remixicon/react": "^4.2.0",
"@sentry/nextjs": "^9.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ListItem,
ListItemLink,
ListItemText,
Grid,
Grid2 as Grid,
Banner,
Breadcrumbs,
} from "ol-components"
Expand Down Expand Up @@ -47,6 +47,7 @@ const SCHOOL_ICONS: Record<string, React.ReactNode> = {
const SchoolTitle = styled.h2(({ theme }) => {
return {
marginBottom: "10px",
marginTop: "0",
display: "flex",
alignItems: "center",
...theme.typography.h5,
Expand Down Expand Up @@ -186,15 +187,6 @@ const SchoolDepartments: React.FC<SchoolDepartmentProps> = ({
)
}

const SchoolList = styled.div(({ theme }) => ({
"> section": {
marginTop: "40px",
[theme.breakpoints.down("sm")]: {
marginTop: "30px",
},
},
}))

const DepartmentListingPage: React.FC = () => {
const channelCountQuery = useChannelCounts("department")
const courseCounts = channelCountQuery.data
Expand Down Expand Up @@ -222,19 +214,28 @@ const DepartmentListingPage: React.FC = () => {
/>
<Container>
<Grid container>
<Grid item xs={0} sm={1}></Grid>
<Grid item xs={12} sm={10}>
<SchoolList>
{schoolsQuery.data?.results?.map((school) => (
<SchoolDepartments
as="li"
key={school.id}
school={school}
courseCounts={courseCounts}
programCounts={programCounts}
/>
))}
</SchoolList>
<Grid
size={{ xs: 12, sm: 10 }}
offset={{ xs: 0, sm: 1 }}
sx={(theme) => ({
display: "flex",
flexDirection: "column",
gap: "40px",
margin: "80px 0",
Copy link
Contributor

Choose a reason for hiding this comment

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

We have some default margin top on the title, so should account for that in the 80pc top margin:

image

In Figma:

image

https://www.figma.com/design/Eux3guSenAFVvNHGi1Y9Wm/MIT-Design-System?node-id=2197-31369&m=dev

[theme.breakpoints.down("sm")]: {
margin: "20px 0",
gap: "30px",
},
})}
>
{schoolsQuery.data?.results?.map((school) => (
<SchoolDepartments
key={school.id}
school={school}
courseCounts={courseCounts}
programCounts={programCounts}
/>
))}
</Grid>
</Grid>
</Container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Container,
Typography,
styled,
Grid,
Grid2 as Grid,
PlainList,
ChipLink,
linkStyles,
Expand Down Expand Up @@ -269,11 +269,7 @@ const groupTopics = (
}

const RootTopicList = styled(PlainList)(({ theme }) => ({
marginTop: "80px",
[theme.breakpoints.down("sm")]: {
marginTop: "32px",
},
"> li": {
"> li:not(:last-of-type)": {
paddingBottom: "32px",
},
"> li + li": {
Expand Down Expand Up @@ -316,8 +312,16 @@ const TopicsListingPage: React.FC = () => {
/>
<Container>
<Grid container>
<Grid item xs={0} sm={1}></Grid>
<Grid item xs={12} sm={10}>
<Grid
size={{ xs: 12, sm: 10 }}
offset={{ xs: 0, sm: 1 }}
sx={(theme) => ({
margin: "80px 0",
[theme.breakpoints.down("sm")]: {
margin: "32px 0",
},
})}
>
<RootTopicList>
{topicsQuery.isLoading
? Array(10)
Expand Down
60 changes: 12 additions & 48 deletions frontends/main/src/app-pages/UnitsListingPage/UnitCard.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import React from "react"
import type { OfferedByEnum } from "api"
import type { UnitChannel } from "api/v0"
import {
Card,
Skeleton,
Typography,
styled,
theme,
UnitLogo,
} from "ol-components"
import { Card, Skeleton, styled, theme, UnitLogo } from "ol-components"
import Link from "next/link"
import { usePostHog } from "posthog-js/react"
import { PostHogEvents } from "@/common/constants"
Expand All @@ -23,9 +16,6 @@ const UnitCardContainer = styled.div({
alignItems: "center",
height: "100%",
backgroundColor: "rgba(243, 244, 248, 0.50)",
[theme.breakpoints.down("md")]: {
backgroundColor: theme.custom.colors.white,
},
})

const UnitCardContent = styled.div({
Expand All @@ -39,7 +29,7 @@ const LogoContainer = styled.div({
padding: "40px 32px",
backgroundColor: theme.custom.colors.white,
[theme.breakpoints.down("md")]: {
padding: "34px 0 14px",
padding: "24px 16px",
".MuiSkeleton-root": {
margin: "0 auto",
},
Expand All @@ -50,6 +40,7 @@ const LogoContainer = styled.div({
height: "40px",
Copy link
Contributor

Choose a reason for hiding this comment

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

These are not horizontally centered at <md. Figma has a top and bottom padding of 24px (we have 34px and 14px).

image

https://www.figma.com/design/Eux3guSenAFVvNHGi1Y9Wm/MIT-Design-System?node-id=14674-72974&m=dev

image

margin: "0 auto",
},
maxWidth: "calc(100% - 32px)",
},
})

Expand All @@ -59,50 +50,25 @@ const CardBottom = styled.div({
display: "flex",
flexGrow: 1,
flexDirection: "column",
justifyContent: "space-between",
gap: "24px",
...theme.typography.body1,
[theme.breakpoints.down("md")]: {
...theme.typography.body2,
padding: "16px",
gap: "10px",
borderTop: "none",
gap: "16px",
},
})

const ValuePropContainer = styled.div({
display: "flex",
flexDirection: "column",
alignItems: "flex-start",
justifyContent: "flex-start",
flexGrow: 1,
paddingBottom: "16px",
})

const LoadingContent = styled.div({
padding: "24px",
})

const HeadingText = styled.span(({ theme }) => ({
alignSelf: "stretch",
color: theme.custom.colors.darkGray2,
...theme.typography.body2,
}))

const CountsTextContainer = styled.div({
display: "flex",
gap: "10px",
[theme.breakpoints.down("md")]: {
justifyContent: "flex-end",
},
})

const CountsText = styled(Typography)(({ theme }) => ({
color: theme.custom.colors.darkGray2,
...theme.typography.body2,
[theme.breakpoints.down("md")]: {
...theme.typography.body3,
color: theme.custom.colors.silverGrayDark,
},
}))

interface UnitCardsProps {
channels: UnitChannel[] | undefined
courseCounts: Record<string, number>
Expand Down Expand Up @@ -144,16 +110,14 @@ const UnitCard: React.FC<UnitCardProps> = (props) => {
</Link>
</LogoContainer>
<CardBottom>
<ValuePropContainer>
<HeadingText>{channel?.configuration?.heading}</HeadingText>
</ValuePropContainer>
{channel?.configuration?.heading}
<CountsTextContainer>
<CountsText data-testid={`course-count-${unit.code}`}>
<span data-testid={`course-count-${unit.code}`}>
{courseCount > 0 ? `Courses: ${courseCount}` : ""}
</CountsText>
<CountsText data-testid={`program-count-${unit.code}`}>
</span>
<span data-testid={`program-count-${unit.code}`}>
{programCount > 0 ? `Programs: ${programCount}` : ""}
</CountsText>
</span>
</CountsTextContainer>
</CardBottom>
</UnitCardContent>
Expand Down
14 changes: 7 additions & 7 deletions frontends/main/src/page-components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import {
RiVerifiedBadgeLine,
RiFileAddLine,
RiTimeLine,
RiHeartLine,
RiPriceTag3Line,
RiAwardLine,
RiThumbUpLine,
} from "@remixicon/react"
import { useToggle } from "ol-utilities"
import MITLogoLink from "@/components/MITLogoLink/MITLogoLink"
Expand Down Expand Up @@ -241,18 +241,18 @@ const navData: NavData = {
href: SEARCH_NEW,
posthogEvent: PostHogEvents.ClickedNavBrowseNew,
},
{
title: "Popular",
href: SEARCH_POPULAR,
icon: <RiThumbUpLine />,
posthogEvent: PostHogEvents.ClickedNavBrowsePopular,
},
{
title: "Upcoming",
icon: <RiTimeLine />,
href: SEARCH_UPCOMING,
posthogEvent: PostHogEvents.ClickedNavBrowseUpcoming,
},
{
title: "Popular",
href: SEARCH_POPULAR,
icon: <RiHeartLine />,
posthogEvent: PostHogEvents.ClickedNavBrowsePopular,
},
{
title: "Free",
icon: <RiPriceTag3Line />,
Expand Down
4 changes: 2 additions & 2 deletions frontends/main/src/page-components/HeroSearch/HeroSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import {
import {
RiAwardLine,
RiFileAddLine,
RiPriceTag3Line,
RiSearch2Line,
RiThumbUpLine,
RiTimeLine,
RiVerifiedBadgeLine,
} from "@remixicon/react"
import Image from "next/image"
import { SearchField } from "@/page-components/SearchField/SearchField"
Expand Down Expand Up @@ -63,7 +63,7 @@ const SEARCH_CHIPS: SearchChip[] = [
label: "Free",
href: SEARCH_FREE,
variant: "outlinedWhite",
icon: <RiVerifiedBadgeLine />,
icon: <RiPriceTag3Line />,
},
{
label: "With Certificate",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ const StyledToggleButtonGroup = styled(ToggleButtonGroup)`
height: 40px;
border-radius: 4px;
`
const StyledButtonGroupContainer = styled.div`
margin-top: 10px;
margin-bottom: 10px;
`

const ExplanationContainer = styled.div`
margin: 10px;
font-size: 0.875em;
Expand Down Expand Up @@ -50,17 +47,40 @@ const StyledToggleButton = styled(ToggleButton)(({ theme }) => ({
backgroundColor: theme.custom.colors.white,
},
...theme.typography.subtitle3,

// MUI's ToggleButtonGroup have a -1 margin offset that caused problems for our borders.
"&.MuiToggleButtonGroup-middleButton, .MuiToggleButtonGroup-lastButton": {
margin: 0,
},
/**
* The goal here is to ensure the icons:
* - scale at same rate when container shrinks
* - are hidden if container is too small
*
* NOTE: containerType: size enables the container query but requires setting
* a width on the container. We are doing this anyway.
Comment on lines +56 to +61
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mbilalmughal Regarding Academic and Professional Icon scaling: As described in the issue, they scale at different rates on RC as window size decreases and it doesn't look great.

Here are few options for addressing this issue. For now, (2) is implemented.

  1. Scale at same rate. They get very small. Awkward. (The button border still exists, just isn't really showing up in the video.)

    option_shrinking_icons.mov
  2. Scale at same rate, but disappear after they get kinda small.

    option_disappearing_icons.mov
  3. Change the facet sidebar so that it has a fixed width of 300px, or a width that scales between 275px and 300px, but never goes below 300px.

  4. Remove the icons all together. This is simplest.

IMO (3) would be a good solution. When the facet sidebar gets too narrow it affects usability IMO. That said, I don't think we should consider (3) for now. This change would cause some issues with the cards getting too narrow.

Choose a reason for hiding this comment

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

@ChristopherChudzicki I believe what you’ve done on (2) is great, Removing the icon makes sense here. 👍

*/
containerType: "size",
boxSizing: "border-box",
"& > span": {
minWidth: "70px",
},
"@container (max-width: 85px)": {
"& > svg": {
display: "none",
},
},
}))

const ViewAllButton = styled(StyledToggleButton)`
border-right: 2px solid;
border-right: 1px solid;
border-color: ${({ theme }) => theme.custom.colors.silverGrayLight};
width: 20%;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
`
const AcademicButton = styled(StyledToggleButton)`
border-right: 2px solid;
border-right: 1px solid;
border-color: ${({ theme }) => theme.custom.colors.silverGrayLight};
width: 40%;
`
Expand Down Expand Up @@ -88,18 +108,18 @@ const ProfessionalToggle: React.FC<{
}

return (
<StyledButtonGroupContainer>
<div>
<StyledToggleButtonGroup
value={professionalSetting}
exclusive
onChange={handleChange}
>
<ViewAllButton value="">All</ViewAllButton>
<AcademicButton value="false">
<StyledRiBookOpenLine /> Academic
<StyledRiBookOpenLine /> <span>Academic</span>
</AcademicButton>
<ProfesionalButton value="true">
<StyledRiBriefcase3Line /> Professional
<StyledRiBriefcase3Line /> <span>Professional</span>
</ProfesionalButton>
</StyledToggleButtonGroup>
<Collapse in={professionalSetting === ""}>
Expand All @@ -117,7 +137,7 @@ const ProfessionalToggle: React.FC<{
Content developed from MIT's professional curriculum
</ExplanationContainer>
</Collapse>
</StyledButtonGroupContainer>
</div>
)
}

Expand Down
Loading
Loading