Skip to content

Conversation

@jkachel
Copy link
Contributor

@jkachel jkachel commented Jun 13, 2024

What are the relevant tickets?

Closes mitodl/hq#4559
Closes mitodl/hq#4541

Description (What does it do?)

  1. Adds the marketing images to the static folder, per the issue.
  2. Updates the cards to use a random image from that list rather than the avatar or cover image.
  3. Adds the avatar image to the name block on the card
  4. Styling fixes for the quote, name block, and quote leader
  5. Change the button style to match the other pager buttons
  6. Add tests for testimonial sliders

Screenshots (if appropriate):

Regular desktop:
Screenshot 2024-06-17 at 10 20 55 AM

Extra-wide desktop:
Screenshot 2024-06-17 at 10 21 04 AM

Mobile:
Screenshot 2024-06-17 at 10 21 17 AM

How can this be tested?

Automated tests should pass. This includes some new tests for the testimonial sliders, so those specifically should pass - they're in HomePage.test.tsx and TestimonialDisplay.test.tsx.

The layout should more closely match what's in Figma now, and the cover image on the left should be one of the six marketing images. This just chooses one at random, it makes no effort to check to see if one's already been chosen or not.

For the unit page testimonials: the attestant block is now its own component - this should have no real change on the unit page sliders but it is a change.

@jkachel jkachel force-pushed the jkachel/4559-updates-to-testimonial-carousel branch from 46ead5e to 39bbb3f Compare June 14, 2024 16:12
jkachel added 4 commits June 17, 2024 10:11
- Moved the attestant info to its own component
- Styling fixes for the homepage carousel
- Limiting the homepage carousel to max 1440px per 4541
@jkachel jkachel force-pushed the jkachel/4559-updates-to-testimonial-carousel branch from 24f02d6 to aec971e Compare June 17, 2024 15:15
pre-commit-ci bot and others added 3 commits June 17, 2024 15:17
@jkachel jkachel marked this pull request as ready for review June 17, 2024 15:20
@jkachel jkachel added Needs Review An open Pull Request that is ready for review product:mit-open Issues related to the MIT Open product labels Jun 17, 2024
@gumaerc gumaerc self-assigned this Jun 17, 2024
Copy link
Contributor

@gumaerc gumaerc left a comment

Choose a reason for hiding this comment

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

This functions well and solves all the problems in the issues. The spacings all match Figma, but the design should probably be reviewed by @steven-hatch and Bilal (Github won't tag him for me for some reason). I found a few things that I wanted to ask about:

color: theme.custom.colors.mitRed,
fontStyle: "normal",
height: pxToRem(80),
fontWeight: theme.typography.fontWeightBold,
Copy link
Contributor

Choose a reason for hiding this comment

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

In typography.ts, we define 3 font weights that match the designs:

const fontWeights = {
  text: {
    roman: 400,
    medium: 500,
    bold: 700,
  },
}

Thus, the values you end up getting here come from the MUI defaults. In typography.ts, can we assign the MUI properties to our values specified here? For example:

const globalSettings: ThemeOptions["typography"] = {
  // Note: Figma calls this "Neue Haas Grotesk Text", but that is incorrect based on Adobe's font family.
  fontFamily: "neue-haas-grotesk-text, sans-serif",
  fontWeightLight: fontWeights.text.roman,
  fontWeightRegular: fontWeights.text.roman,
  fontWeightMedium: fontWeights.text.medium,
  fontWeightBold: fontWeights.text.bold,
  ...

The MUI defaults don't end up being functionally different (MUI has 300 for light and we use 400) but using the values defined here will ensure that the values match the font we've chosen, in this case neue-haas-grotesk-text, sans-serif.

We actually have a linting rule that is supposed to disable manually specifying font-weight, but I think it was allowed here because it only disallows numeric weights. Anyway, this is definitely a special case as it's not really regular text and is effectively being used here as an icon. Maybe this whole thing would be better as an SVG, but that's another conversation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I basically just added the font weights into the theme options as specified. There are a couple other places where this gets used:

  • mit-open/src/pages/HomePage/NewsEventsSection.tsx
  • ol-components/src/components/ChoiceBox/ChoiceBox.tsx

The onboarding is broken for me locally at the moment, which is where ChoiceBox seems to be used exclusively, but the news and events section didn't seem to change.

Copy link
Contributor

Choose a reason for hiding this comment

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

My point was more that the MUI font weight properties (i.e. theme.typography.fontWeightbold) are not currently customized by our theme, so when you call those properties now you are going to get the MUI defaults. For theme.typography.fontWeightLight for example, you get 300 back whereas in our case that should be 400. This recommendation is based on a conversation with @ChristopherChudzicki about how our specified font weights relate to the imported Abobe font.

}

const generateMarketingImageSrc = () => {
const idx = Math.floor(Math.random() * 6) + 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there something we can do here to ensure that two of the same images don't land directly next to each other? This happened to me and of course I didn't get a screenshot of it, but it didn't look great to have the exact same images on two cards... at least side by side.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added some code to do this - you will still get wraparound but it shouldn't drop one next to each other. The algorithm is pretty simple but can also set it up so that you don't get a repeat until all of them have been seen once.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, that makes sense. We can always add more marketing images too... as long as we have more images than attestations then we'll never see a repeat.

@gumaerc gumaerc assigned jkachel and unassigned gumaerc Jun 17, 2024
@gumaerc gumaerc added Waiting on author and removed Needs Review An open Pull Request that is ready for review labels Jun 17, 2024
…ake sure the marketing images don't appear twice in a row
@jkachel jkachel requested a review from gumaerc June 17, 2024 20:11
@jkachel jkachel added Needs Review An open Pull Request that is ready for review and removed Waiting on author labels Jun 17, 2024
@jkachel jkachel assigned gumaerc and unassigned jkachel Jun 17, 2024
Copy link
Contributor

@gumaerc gumaerc left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@gumaerc gumaerc removed their assignment Jun 17, 2024
@gumaerc gumaerc added Waiting on author and removed Needs Review An open Pull Request that is ready for review labels Jun 17, 2024
@jkachel jkachel merged commit 180d5ce into main Jun 17, 2024
@jkachel jkachel deleted the jkachel/4559-updates-to-testimonial-carousel branch June 17, 2024 21:00
@odlbot odlbot mentioned this pull request Jun 18, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:mit-open Issues related to the MIT Open product Waiting on author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants