Page MenuHomePhabricator

[landing] make typography responsive
ClosedPublic

Authored by ginsu on Jun 9 2023, 2:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 11, 9:51 AM
Unknown Object (File)
Thu, Apr 11, 9:51 AM
Unknown Object (File)
Thu, Apr 11, 9:51 AM
Unknown Object (File)
Mar 27 2024, 11:54 PM
Unknown Object (File)
Mar 5 2024, 9:30 PM
Unknown Object (File)
Mar 4 2024, 3:11 AM
Unknown Object (File)
Mar 3 2024, 9:47 PM
Unknown Object (File)
Feb 10 2024, 4:14 PM

Details

Summary

Based on feedback I got in D8080 and @ted during our sync earlier in the week we disscued making the typography responsive to the screen width so that we would get a smaller font size/line height when we on a smaller screen like a phone.

The general strategy to make the text responsive was to set the max font-size/line-height to be what we initially had, but then as the screen size would go down we would decrease the font-size/line-height until we went one level down (heading1 => heading2) and set that to the min font-size/line-height. For typographies that did not have a level down (for example display3) I would take a look at the rate at which we were decreasing the font-size/line-height for each level before that and just use that rate to determine the min font-size/line-height.

To figure out what the middle value of the clamp should be, I used a fluid typography calculator which took in four values: min font size, max font size, min viewport, and max viewport. I set the min/max font sizes based on what I did above, but for the min viewport I used 20rem (320px) and 90rem (1440px) which are media query breakpoint values found in the figma document.

Depends on D8172

Links to calculators used:
https://nekocalc.com/rem-to-px-converter
https://royalfig.github.io/fluid-typography-calculator/

Test Plan

Went through each screen/component and made sure that there were no visual regressions. Also got @ted's stamp of approval

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Jun 9 2023, 2:54 PM
Harbormaster failed remote builds in B20164: Diff 27623!
ginsu requested review of this revision.Jun 9 2023, 3:10 PM
landing/typography.css
11 ↗(On Diff #27623)

The first font-size and line-height value is a fallback value if something with the clamp goes wrong

Trusting the numbers, would be good if there was a comment explaining where the numbers come from

landing/typography.css
12 ↗(On Diff #27623)

Do we really need this many digits after the decimal?

This revision is now accepted and ready to land.Jun 12 2023, 7:37 AM
landing/typography.css
12 ↗(On Diff #27623)

To figure out what the middle value of the clamp should be, I used a fluid typography calculator which took in four values: min font size, max font size, min viewport, and max viewport. I set the min/max font sizes based on what I did above, but for the min viewport I used 20rem (320px) and 90rem (1440px) which are media query breakpoint values found in the figma document.

Screenshot 2023-06-12 at 10.50.02 AM.png (1×3 px, 1 MB)

These values were copied and pasted from this calculator so I would prefer we keep them as is, but we could probably remove a few digits if we feel strongly that there are too many digits

This revision was landed with ongoing or failed builds.Aug 8 2023, 2:09 PM
This revision was automatically updated to reflect the committed changes.