Skip to content

Commit b078c99

Browse files
Design QA (#2308)
* update smoot to proper release * align price spacing w figma * change sidebar filter order, align icons with hero * fix ListRow card mobile title size * improve search page filter spacing for mobile * align units page with figma * center free in search facets * fix userlist row icon size * fix topics top/bottom spacing * fix departments page spacing * fix filter section title spacing * make search input font neue haas * remove gridcolumn, gridcontainer from search page * hide icons when too button shrinks * fix unit logo alignment * fix a few spacing issues in department page * fix a spacing issue in topic page * fix certificate icon padding on learning resource cards
1 parent f40017d commit b078c99

File tree

10 files changed

+177
-199
lines changed

10 files changed

+177
-199
lines changed

frontends/main/src/app-pages/DepartmentListingPage/DepartmentListingPage.tsx

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
ListItem,
1010
ListItemLink,
1111
ListItemText,
12-
Grid,
12+
Grid2 as Grid,
1313
Banner,
1414
Breadcrumbs,
1515
} from "ol-components"
@@ -47,6 +47,7 @@ const SCHOOL_ICONS: Record<string, React.ReactNode> = {
4747
const SchoolTitle = styled.h2(({ theme }) => {
4848
return {
4949
marginBottom: "10px",
50+
marginTop: "0",
5051
display: "flex",
5152
alignItems: "center",
5253
...theme.typography.h5,
@@ -186,15 +187,6 @@ const SchoolDepartments: React.FC<SchoolDepartmentProps> = ({
186187
)
187188
}
188189

189-
const SchoolList = styled.div(({ theme }) => ({
190-
"> section": {
191-
marginTop: "40px",
192-
[theme.breakpoints.down("sm")]: {
193-
marginTop: "30px",
194-
},
195-
},
196-
}))
197-
198190
const DepartmentListingPage: React.FC = () => {
199191
const channelCountQuery = useChannelCounts("department")
200192
const courseCounts = channelCountQuery.data
@@ -222,19 +214,28 @@ const DepartmentListingPage: React.FC = () => {
222214
/>
223215
<Container>
224216
<Grid container>
225-
<Grid item xs={0} sm={1}></Grid>
226-
<Grid item xs={12} sm={10}>
227-
<SchoolList>
228-
{schoolsQuery.data?.results?.map((school) => (
229-
<SchoolDepartments
230-
as="li"
231-
key={school.id}
232-
school={school}
233-
courseCounts={courseCounts}
234-
programCounts={programCounts}
235-
/>
236-
))}
237-
</SchoolList>
217+
<Grid
218+
size={{ xs: 12, sm: 10 }}
219+
offset={{ xs: 0, sm: 1 }}
220+
sx={(theme) => ({
221+
display: "flex",
222+
flexDirection: "column",
223+
gap: "40px",
224+
margin: "80px 0",
225+
[theme.breakpoints.down("sm")]: {
226+
margin: "20px 0",
227+
gap: "30px",
228+
},
229+
})}
230+
>
231+
{schoolsQuery.data?.results?.map((school) => (
232+
<SchoolDepartments
233+
key={school.id}
234+
school={school}
235+
courseCounts={courseCounts}
236+
programCounts={programCounts}
237+
/>
238+
))}
238239
</Grid>
239240
</Grid>
240241
</Container>

frontends/main/src/app-pages/TopicsListingPage/TopicsListingPage.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
Container,
66
Typography,
77
styled,
8-
Grid,
8+
Grid2 as Grid,
99
PlainList,
1010
ChipLink,
1111
linkStyles,
@@ -269,11 +269,7 @@ const groupTopics = (
269269
}
270270

271271
const RootTopicList = styled(PlainList)(({ theme }) => ({
272-
marginTop: "80px",
273-
[theme.breakpoints.down("sm")]: {
274-
marginTop: "32px",
275-
},
276-
"> li": {
272+
"> li:not(:last-of-type)": {
277273
paddingBottom: "32px",
278274
},
279275
"> li + li": {
@@ -316,8 +312,16 @@ const TopicsListingPage: React.FC = () => {
316312
/>
317313
<Container>
318314
<Grid container>
319-
<Grid item xs={0} sm={1}></Grid>
320-
<Grid item xs={12} sm={10}>
315+
<Grid
316+
size={{ xs: 12, sm: 10 }}
317+
offset={{ xs: 0, sm: 1 }}
318+
sx={(theme) => ({
319+
margin: "80px 0",
320+
[theme.breakpoints.down("sm")]: {
321+
margin: "32px 0",
322+
},
323+
})}
324+
>
321325
<RootTopicList>
322326
{topicsQuery.isLoading
323327
? Array(10)

frontends/main/src/app-pages/UnitsListingPage/UnitCard.tsx

Lines changed: 12 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
import React from "react"
22
import type { OfferedByEnum } from "api"
33
import type { UnitChannel } from "api/v0"
4-
import {
5-
Card,
6-
Skeleton,
7-
Typography,
8-
styled,
9-
theme,
10-
UnitLogo,
11-
} from "ol-components"
4+
import { Card, Skeleton, styled, theme, UnitLogo } from "ol-components"
125
import Link from "next/link"
136
import { usePostHog } from "posthog-js/react"
147
import { PostHogEvents } from "@/common/constants"
@@ -23,9 +16,6 @@ const UnitCardContainer = styled.div({
2316
alignItems: "center",
2417
height: "100%",
2518
backgroundColor: "rgba(243, 244, 248, 0.50)",
26-
[theme.breakpoints.down("md")]: {
27-
backgroundColor: theme.custom.colors.white,
28-
},
2919
})
3020

3121
const UnitCardContent = styled.div({
@@ -39,7 +29,7 @@ const LogoContainer = styled.div({
3929
padding: "40px 32px",
4030
backgroundColor: theme.custom.colors.white,
4131
[theme.breakpoints.down("md")]: {
42-
padding: "34px 0 14px",
32+
padding: "24px 16px",
4333
".MuiSkeleton-root": {
4434
margin: "0 auto",
4535
},
@@ -50,6 +40,7 @@ const LogoContainer = styled.div({
5040
height: "40px",
5141
margin: "0 auto",
5242
},
43+
maxWidth: "calc(100% - 32px)",
5344
},
5445
})
5546

@@ -59,50 +50,25 @@ const CardBottom = styled.div({
5950
display: "flex",
6051
flexGrow: 1,
6152
flexDirection: "column",
53+
justifyContent: "space-between",
6254
gap: "24px",
55+
...theme.typography.body1,
6356
[theme.breakpoints.down("md")]: {
57+
...theme.typography.body2,
6458
padding: "16px",
65-
gap: "10px",
66-
borderTop: "none",
59+
gap: "16px",
6760
},
6861
})
6962

70-
const ValuePropContainer = styled.div({
71-
display: "flex",
72-
flexDirection: "column",
73-
alignItems: "flex-start",
74-
justifyContent: "flex-start",
75-
flexGrow: 1,
76-
paddingBottom: "16px",
77-
})
78-
7963
const LoadingContent = styled.div({
8064
padding: "24px",
8165
})
8266

83-
const HeadingText = styled.span(({ theme }) => ({
84-
alignSelf: "stretch",
85-
color: theme.custom.colors.darkGray2,
86-
...theme.typography.body2,
87-
}))
88-
8967
const CountsTextContainer = styled.div({
9068
display: "flex",
9169
gap: "10px",
92-
[theme.breakpoints.down("md")]: {
93-
justifyContent: "flex-end",
94-
},
9570
})
9671

97-
const CountsText = styled(Typography)(({ theme }) => ({
98-
color: theme.custom.colors.darkGray2,
99-
...theme.typography.body2,
100-
[theme.breakpoints.down("md")]: {
101-
...theme.typography.body3,
102-
color: theme.custom.colors.silverGrayDark,
103-
},
104-
}))
105-
10672
interface UnitCardsProps {
10773
channels: UnitChannel[] | undefined
10874
courseCounts: Record<string, number>
@@ -144,16 +110,14 @@ const UnitCard: React.FC<UnitCardProps> = (props) => {
144110
</Link>
145111
</LogoContainer>
146112
<CardBottom>
147-
<ValuePropContainer>
148-
<HeadingText>{channel?.configuration?.heading}</HeadingText>
149-
</ValuePropContainer>
113+
{channel?.configuration?.heading}
150114
<CountsTextContainer>
151-
<CountsText data-testid={`course-count-${unit.code}`}>
115+
<span data-testid={`course-count-${unit.code}`}>
152116
{courseCount > 0 ? `Courses: ${courseCount}` : ""}
153-
</CountsText>
154-
<CountsText data-testid={`program-count-${unit.code}`}>
117+
</span>
118+
<span data-testid={`program-count-${unit.code}`}>
155119
{programCount > 0 ? `Programs: ${programCount}` : ""}
156-
</CountsText>
120+
</span>
157121
</CountsTextContainer>
158122
</CardBottom>
159123
</UnitCardContent>

frontends/main/src/page-components/Header/Header.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import {
1414
RiVerifiedBadgeLine,
1515
RiFileAddLine,
1616
RiTimeLine,
17-
RiHeartLine,
1817
RiPriceTag3Line,
1918
RiAwardLine,
19+
RiThumbUpLine,
2020
} from "@remixicon/react"
2121
import { useToggle } from "ol-utilities"
2222
import MITLogoLink from "@/components/MITLogoLink/MITLogoLink"
@@ -241,18 +241,18 @@ const navData: NavData = {
241241
href: SEARCH_NEW,
242242
posthogEvent: PostHogEvents.ClickedNavBrowseNew,
243243
},
244+
{
245+
title: "Popular",
246+
href: SEARCH_POPULAR,
247+
icon: <RiThumbUpLine />,
248+
posthogEvent: PostHogEvents.ClickedNavBrowsePopular,
249+
},
244250
{
245251
title: "Upcoming",
246252
icon: <RiTimeLine />,
247253
href: SEARCH_UPCOMING,
248254
posthogEvent: PostHogEvents.ClickedNavBrowseUpcoming,
249255
},
250-
{
251-
title: "Popular",
252-
href: SEARCH_POPULAR,
253-
icon: <RiHeartLine />,
254-
posthogEvent: PostHogEvents.ClickedNavBrowsePopular,
255-
},
256256
{
257257
title: "Free",
258258
icon: <RiPriceTag3Line />,

frontends/main/src/page-components/HeroSearch/HeroSearch.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ import {
2424
import {
2525
RiAwardLine,
2626
RiFileAddLine,
27+
RiPriceTag3Line,
2728
RiSearch2Line,
2829
RiThumbUpLine,
2930
RiTimeLine,
30-
RiVerifiedBadgeLine,
3131
} from "@remixicon/react"
3232
import Image from "next/image"
3333
import { SearchField } from "@/page-components/SearchField/SearchField"
@@ -63,7 +63,7 @@ const SEARCH_CHIPS: SearchChip[] = [
6363
label: "Free",
6464
href: SEARCH_FREE,
6565
variant: "outlinedWhite",
66-
icon: <RiVerifiedBadgeLine />,
66+
icon: <RiPriceTag3Line />,
6767
},
6868
{
6969
label: "With Certificate",

frontends/main/src/page-components/SearchDisplay/ProfessionalToggle.tsx

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ const StyledToggleButtonGroup = styled(ToggleButtonGroup)`
1212
height: 40px;
1313
border-radius: 4px;
1414
`
15-
const StyledButtonGroupContainer = styled.div`
16-
margin-top: 10px;
17-
margin-bottom: 10px;
18-
`
15+
1916
const ExplanationContainer = styled.div`
2017
margin: 10px;
2118
font-size: 0.875em;
@@ -50,17 +47,40 @@ const StyledToggleButton = styled(ToggleButton)(({ theme }) => ({
5047
backgroundColor: theme.custom.colors.white,
5148
},
5249
...theme.typography.subtitle3,
50+
51+
// MUI's ToggleButtonGroup have a -1 margin offset that caused problems for our borders.
52+
"&.MuiToggleButtonGroup-middleButton, .MuiToggleButtonGroup-lastButton": {
53+
margin: 0,
54+
},
55+
/**
56+
* The goal here is to ensure the icons:
57+
* - scale at same rate when container shrinks
58+
* - are hidden if container is too small
59+
*
60+
* NOTE: containerType: size enables the container query but requires setting
61+
* a width on the container. We are doing this anyway.
62+
*/
63+
containerType: "size",
64+
boxSizing: "border-box",
65+
"& > span": {
66+
minWidth: "70px",
67+
},
68+
"@container (max-width: 85px)": {
69+
"& > svg": {
70+
display: "none",
71+
},
72+
},
5373
}))
5474

5575
const ViewAllButton = styled(StyledToggleButton)`
56-
border-right: 2px solid;
76+
border-right: 1px solid;
5777
border-color: ${({ theme }) => theme.custom.colors.silverGrayLight};
5878
width: 20%;
5979
border-top-left-radius: 4px;
6080
border-bottom-left-radius: 4px;
6181
`
6282
const AcademicButton = styled(StyledToggleButton)`
63-
border-right: 2px solid;
83+
border-right: 1px solid;
6484
border-color: ${({ theme }) => theme.custom.colors.silverGrayLight};
6585
width: 40%;
6686
`
@@ -88,18 +108,18 @@ const ProfessionalToggle: React.FC<{
88108
}
89109

90110
return (
91-
<StyledButtonGroupContainer>
111+
<div>
92112
<StyledToggleButtonGroup
93113
value={professionalSetting}
94114
exclusive
95115
onChange={handleChange}
96116
>
97117
<ViewAllButton value="">All</ViewAllButton>
98118
<AcademicButton value="false">
99-
<StyledRiBookOpenLine /> Academic
119+
<StyledRiBookOpenLine /> <span>Academic</span>
100120
</AcademicButton>
101121
<ProfesionalButton value="true">
102-
<StyledRiBriefcase3Line /> Professional
122+
<StyledRiBriefcase3Line /> <span>Professional</span>
103123
</ProfesionalButton>
104124
</StyledToggleButtonGroup>
105125
<Collapse in={professionalSetting === ""}>
@@ -117,7 +137,7 @@ const ProfessionalToggle: React.FC<{
117137
Content developed from MIT's professional curriculum
118138
</ExplanationContainer>
119139
</Collapse>
120-
</StyledButtonGroupContainer>
140+
</div>
121141
)
122142
}
123143

0 commit comments

Comments
 (0)