-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Try: apply the new type scale #18244
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 |
---|---|---|
@@ -1,3 +1,83 @@ | ||
/** | ||
* Type scale mixins | ||
*/ | ||
|
||
@mixin text-title-large { | ||
$font-size: 32px; | ||
font-weight: 400; | ||
font-size: $font-size; | ||
line-height: (40px / $font-size); // line-height in px divided by font-size | ||
} | ||
|
||
@mixin text-title-medium { | ||
$font-size: 24px; | ||
font-weight: 400; | ||
font-size: $font-size; | ||
line-height: (32px / $font-size); // line-height in px divided by font-size | ||
} | ||
|
||
@mixin text-title-small { | ||
$font-size: 20px; | ||
font-weight: 400; | ||
font-size: $font-size; | ||
line-height: (28px / $font-size); // line-height in px divided by font-size | ||
} | ||
|
||
@mixin text-subtitle { | ||
$font-size: 16px; | ||
font-weight: 600; | ||
font-size: $font-size; | ||
line-height: (24px / $font-size); // line-height in px divided by font-size | ||
} | ||
|
||
@mixin text-subtitle-small { | ||
$font-size: 14px; | ||
font-weight: 600; | ||
font-size: $font-size; | ||
line-height: (20px / $font-size); // line-height in px divided by font-size | ||
} | ||
|
||
@mixin text-body { | ||
$font-size: 16px; | ||
font-weight: 400; | ||
font-size: $font-size; | ||
line-height: (24px / $font-size); // line-height in px divided by font-size | ||
} | ||
|
||
@mixin text-body-small { | ||
$font-size: 14px; | ||
font-weight: 400; | ||
font-size: $font-size; | ||
line-height: (20px / $font-size); // line-height in px divided by font-size | ||
} | ||
|
||
@mixin text-button { | ||
$font-size: 14px; | ||
font-weight: 600; | ||
font-size: $font-size; | ||
line-height: (20px / $font-size); // line-height in px divided by font-size | ||
} | ||
|
||
@mixin text-caption { | ||
$font-size: 12px; | ||
font-weight: 400; | ||
font-size: $font-size; | ||
line-height: (16px / $font-size); // line-height in px divided by font-size | ||
} | ||
|
||
@mixin text-label { | ||
$font-size: 12px; | ||
font-weight: 600; | ||
font-size: $font-size; | ||
line-height: (16px / $font-size); // line-height in px divided by font-size | ||
} | ||
|
||
// Utility classes | ||
|
||
.block-editor-page .text-caption { | ||
@include text-caption; | ||
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. Might be a better way to do this. I had to add a class here: |
||
} | ||
|
||
/** | ||
* Breakpoint mixins | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,15 +4,15 @@ | |
|
||
// Fonts & basics | ||
$default-font: -apple-system, BlinkMacSystemFont,"Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell,"Helvetica Neue", sans-serif; | ||
$default-font-size: 13px; | ||
$default-line-height: 1.4; | ||
$default-font-size: 14px; | ||
$default-line-height: (20px / $default-font-size); // line-height in px divided by font-size | ||
$editor-font: "Noto Serif", serif; | ||
$editor-html-font: Menlo, Consolas, monaco, monospace; | ||
$editor-font-size: 16px; | ||
$default-block-margin: 28px; // This value provides a consistent, contiguous spacing between blocks (it's 2x $block-padding). | ||
$text-editor-font-size: 14px; | ||
$editor-line-height: 1.8; | ||
$big-font-size: 18px; | ||
$big-font-size: 16px; | ||
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. Do these typography related variables still need to exist now that the mixins exist? Can they be removed or at least deprecated? 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. The ones that are applied to the content of the post need to be kept separate and intact. The type scale shouldn't be applied in the content area because it represents the front end of the site, which is not in the scope of the type scale. For now, the type scale only applies to the application UI. 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. 🆒🆒 Why did it change as part of this PR? 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 think 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. Looks like it's not used that much, but I think I changed it because of this class
which is some sort of title in the inserter popover. Since it's only used a couple times, it might be easier just to eliminate the need for |
||
$mobile-text-min-font-size: 16px; // Any font size below 16px will cause Mobile Safari to "zoom in" | ||
|
||
// Grid size | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1090,18 +1090,16 @@ | |
|
||
.components-toolbar { | ||
border: none; | ||
line-height: 1; | ||
font-family: $default-font; | ||
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. Should 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. Seems like we could get rid of font-family in the mixin. |
||
font-size: 11px; | ||
@include text-caption; | ||
padding: 4px 4px; | ||
background: $light-gray-500; | ||
color: $dark-gray-900; | ||
transition: box-shadow 0.1s linear; | ||
@include reduce-motion("transition"); | ||
|
||
.components-button { | ||
font-size: inherit; | ||
line-height: inherit; | ||
@include text-label; | ||
padding: 0; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,11 @@ | |
@import "./components/warning/style.scss"; | ||
@import "./components/writing-flow/style.scss"; | ||
@import "./hooks/anchor.scss"; | ||
|
||
body { | ||
@include text-body-small; | ||
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. @davewhitley Halloo!!! This PR looks great :). The thing that stuck out to me was applying styles to the overall For example, when this is loaded in WP-Admin, I'm not sure what If we wanted to adjust "global" (in the context of Gutenberg) font styles, would we be able to target just Gutenberg? Hope that makes sense! 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. If we could specify Gutenberg only instead of 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. 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. To apply things just to the editor, it looks like we have to update this file: Adding the |
||
} | ||
|
||
body p { | ||
@include text-body-small; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,7 +141,7 @@ | |
|
||
|
||
&.am-pm button { | ||
font-size: 11px; | ||
font-size: 12px; | ||
font-weight: 600; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
kbd.edit-post-keyboard-shortcut-help__shortcut-term { | ||
@include text-body-small; | ||
} | ||
|
||
.edit-post-keyboard-shortcut-help { | ||
&__section { | ||
margin: 0 0 2rem 0; | ||
|
@@ -9,8 +13,7 @@ | |
} | ||
|
||
&__section-title { | ||
font-size: 0.9rem; | ||
font-weight: 600; | ||
@include text-subtitle-small; | ||
} | ||
|
||
&__shortcut { | ||
|
@@ -26,7 +29,7 @@ | |
} | ||
|
||
&__shortcut-term { | ||
font-weight: 600; | ||
// @include text-body-small; | ||
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. Forgot to delete this. |
||
margin: 0 0 0 1rem; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,7 @@ | |
} | ||
|
||
&__section-title { | ||
font-size: 0.9rem; | ||
font-weight: 600; | ||
@include text-subtitle-small; | ||
} | ||
|
||
&__option { | ||
|
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.
Should we prefix the mixins e.g.
wp-text-title-large
to avoid potential namespace clashes?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.
That seems ok to me, since there will probably be
editor
specific font styles likeeditor-text-body
.