Skip to content
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

Use consistent font sizes in the Utility Bar #2828

Merged
merged 1 commit into from
Jul 12, 2023
Merged
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
5 changes: 5 additions & 0 deletions assets/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -2230,6 +2230,11 @@ product-info .loading-overlay:not(.hidden) ~ *,
animation: animateMenuOpen var(--duration-default) ease;
}

.utility-bar .localization-wrapper .disclosure .localization-form__select,
.utility-bar .localization-wrapper .disclosure__link {
font-size: calc(var(--font-heading-scale) * 1.3rem);
}

@media screen and (min-width: 990px) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The changes look good! Just out of curiosity and so that I can grow better as a developer, what is the purpose of add var(--font-heading-scale)*1.3rem as opposed to just using 1.3rem? Is this a consistent pattern I should be using for font sizes as I noticed that other sections use this calculation for sizing as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! I wanted to match the .h5 font size we use for the announcement bar text, so that they won't go out of sync. I didn't need to wrap it in the media query because the localization pickers in the header only show up above the 750px breakpoint anyway.

We use this calc function to generate the font size so that when merchants adjust the font size scale in Theme Settings > Typography, that var(--font-heading-scale) variable will update and scale up all the text that uses these rules proportionally.

(Ideally we should just be using a variable here, e.g. var(--heading-font-size-h5) rather than repeating that calc function over and over, but we haven't implemented something like that in Dawn.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally we should just be using a variable here, e.g. var(--heading-font-size-h5)

This was going to be my probably-don't-need-to-do-this-now feedback 🙂

body:has(.section-header .header:not(.drawer-menu)) .utility-bar .page-width {
padding-left: 5rem;
Expand Down