-
Notifications
You must be signed in to change notification settings - Fork 1.2k
🚧 Replace font-size() and line-height() with custom properties #4674
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
Changes from all commits
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 |
|---|---|---|
|
|
@@ -348,11 +348,11 @@ $secondary-item-font-size: rem(15px); | |
| padding-left: spacing(); | ||
|
|
||
| .Text { | ||
| font-size: font-size(subheading); | ||
| font-size: var(--fs-1); | ||
|
Member
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. Glad to see we settled on token scales for suggestion(non-blocking): Wonder if we should expand these abbreviations to match the /* This doesn't feel very intuitive */
p {
font-size: var(--p-fs-1);
font-weight: var(--p-font-weight-regular)
}
Contributor
Author
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. I don't feel too strongly either way. Now is the time to play around with this and it will be easy enough to change through the token generator. Would it be worth creating a separate issue to align on naming convention?
Member
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. I don't think a separate issue is necessary personally. If anything I would just have a quick sync with @lgriffee to settle on a convention for v8. Right now it is clear two developers worked on the typography vars. I'm leaning towards expanding since |
||
| color: var(--p-text-subdued); | ||
|
|
||
| @include when-typography-not-condensed { | ||
| font-size: font-size(subheading, large-screen); | ||
| font-size: var(--fs-0); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ $base-font-size: 10px; | |
| } @else if $unit == 'rem' { | ||
| @return $value; | ||
| } @else if $unit == 'px' { | ||
| @return $value / $base-font-size * 1rem; | ||
| @return $value / $default-browser-font-size * 1rem; | ||
|
Contributor
Author
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. This change is related to changing the base font size here https://github.com/Shopify/polaris-react/pull/4674/files#r752497881 |
||
| } @else if $unit == 'em' { | ||
| @return $unit / 1em * 1rem; | ||
| } @else { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,34 +13,34 @@ $typography-condensed: em(640px); | |
| } | ||
|
|
||
| @mixin text-style-caption { | ||
|
Contributor
Author
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. Leaving these |
||
| font-size: font-size(caption); | ||
| font-size: var(--fs-1); | ||
| font-weight: 400; | ||
| line-height: line-height(caption); | ||
|
|
||
| @include when-typography-not-condensed { | ||
| font-size: font-size(caption, large-screen); | ||
| font-size: var(--fs-0); | ||
| line-height: line-height(caption, large-screen); | ||
| } | ||
| } | ||
|
|
||
| @mixin text-style-heading { | ||
| font-size: font-size(heading); | ||
| font-size: var(--fs-8); | ||
| font-weight: 600; | ||
| line-height: line-height(heading); | ||
|
|
||
| @include when-typography-not-condensed { | ||
| font-size: font-size(heading, large-screen); | ||
| font-size: var(--fs-4); | ||
| } | ||
| } | ||
|
|
||
| @mixin text-style-subheading { | ||
| font-size: font-size(subheading); | ||
| font-size: var(--fs-1); | ||
| font-weight: 600; | ||
| line-height: line-height(subheading); | ||
| line-height: var(--lh-0); | ||
| text-transform: uppercase; | ||
|
|
||
| @include when-typography-not-condensed { | ||
| font-size: font-size(subheading, large-screen); | ||
| font-size: var(--fs-0); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -59,15 +59,15 @@ $typography-condensed: em(640px); | |
| } | ||
|
|
||
| @mixin text-style-body { | ||
| font-size: font-size(body); | ||
| font-size: var(--fs-2); | ||
| font-weight: 400; | ||
| line-height: line-height(body); | ||
|
|
||
| text-transform: initial; | ||
| letter-spacing: initial; | ||
|
|
||
| @include when-typography-not-condensed { | ||
| font-size: font-size(body, large-screen); | ||
| font-size: var(--fs-3); | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
Is this the right time to introduce this change? It does impact the rem value we would set the
font-sizeandline-heighttokens to.For context, there has been a previous attempt to make this change, but it was reverted #1590
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.
Might be worth getting @martenbjork to weigh in on this. I know he's experimented with global font size changes in the past
Uh oh!
There was an error while loading. Please reload this page.
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.
My gut feeling is we tackle this when we remove the
remfunction. Would love to know other thoughts.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.
@alex-page ok probably best not to conflate things. it's simple enough to update the token values when we do make the change.