-
Notifications
You must be signed in to change notification settings - Fork 3
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
base: main
Are you sure you want to change the base?
Design QA #2308
Changes from all commits
a94c7e1
af2b1f4
9ca6987
fff758e
26f8a8c
d9587de
88bbb68
3430789
b09a56d
9d08e6c
b74675f
7636a2f
0e23f2d
4c7dc4e
6ba8e9a
ccdb982
2f3c11f
adc2a91
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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" | ||
|
@@ -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({ | ||
|
@@ -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", | ||
}, | ||
|
@@ -50,6 +40,7 @@ const LogoContainer = styled.div({ | |
height: "40px", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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). ![]() https://www.figma.com/design/Eux3guSenAFVvNHGi1Y9Wm/MIT-Design-System?node-id=14674-72974&m=dev ![]() |
||
margin: "0 auto", | ||
}, | ||
maxWidth: "calc(100% - 32px)", | ||
}, | ||
}) | ||
|
||
|
@@ -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> | ||
|
@@ -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> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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%; | ||
` | ||
|
@@ -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 === ""}> | ||
|
@@ -117,7 +137,7 @@ const ProfessionalToggle: React.FC<{ | |
Content developed from MIT's professional curriculum | ||
</ExplanationContainer> | ||
</Collapse> | ||
</StyledButtonGroupContainer> | ||
</div> | ||
) | ||
} | ||
|
||
|
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.
We have some default margin top on the title, so should account for that in the 80pc top margin:
In Figma:
https://www.figma.com/design/Eux3guSenAFVvNHGi1Y9Wm/MIT-Design-System?node-id=2197-31369&m=dev