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

Convert all px values in front-facing styles to relative (em) units #24523

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0ff3380
Merge pull request #1 from WordPress/master
aristath Aug 3, 2020
db8ca29
Button Block: Use relative instead of absolute units
aristath Aug 3, 2020
20e96a5
Use relative units for calendar paddings
aristath Aug 3, 2020
47efef0
Paragraph block: Use relative instead of absolute units
aristath Aug 3, 2020
3eb326a
Text Columns: Prefer relative units
aristath Aug 6, 2020
b204bf8
Quote block: Prefer relative units
aristath Aug 6, 2020
7ae267a
Pullquote block: Prefer relative units
aristath Aug 6, 2020
519dae7
also apply changes to native
aristath Aug 6, 2020
8ee37dd
Latest Comments Block: Prefer relative units
aristath Aug 6, 2020
d6ba20f
Use relative units for social-icons block
aristath Aug 6, 2020
992c777
Don't use $grid-unit-* vars for front-facing styles
aristath Aug 7, 2020
8ac774f
Avoid using $default-block-margin for front-facing styles
aristath Aug 7, 2020
e7dac0d
Merge branch 'aristath/no-front-default-block-margin' into aristath/t…
aristath Aug 12, 2020
a1d6b2d
Merge branch 'aristath/no-front-grid-vars' into aristath/try-relative…
aristath Aug 12, 2020
187a50a
Merge branch 'aristath/text-columns-relative-units' into aristath/try…
aristath Aug 12, 2020
df93076
Merge branch 'aristath/social-icons-relative-units' into aristath/try…
aristath Aug 12, 2020
28c9b99
Merge branch 'aristath/pullquote-block-relative-units' into aristath/…
aristath Aug 12, 2020
2041b02
Merge branch 'aristath/quote-block-relative-units' into aristath/try-…
aristath Aug 12, 2020
1ad1c28
Merge branch 'button-block-relative-units' into aristath/try-relative…
aristath Aug 12, 2020
dfa8e80
Merge branch 'calendar-block-relatve-units' into aristath/try-relativ…
aristath Aug 12, 2020
7922206
Merge branch 'p-block-relative-units' into aristath/try-relative-units
aristath Aug 12, 2020
7ef1e21
Merge branch 'aristath/latest-comments-relative-units' into aristath/…
aristath Aug 12, 2020
5479bc0
Convert all remaining pixel values to rem
aristath Aug 12, 2020
3a2b095
Use em instead of rem
aristath Aug 13, 2020
4d72408
Merge branch 'master' into aristath/try-relative-units
aristath Aug 13, 2020
ae64ed0
Use the vars
aristath Aug 13, 2020
31c5f91
restore original code block padding
aristath Aug 14, 2020
4afbe33
Update packages/block-library/src/button/style.scss
aristath Aug 14, 2020
0e71afe
Update packages/block-library/src/latest-comments/style.scss
aristath Aug 14, 2020
2b503a2
Move vars to separate "group" and fix comments capitalization
aristath Aug 14, 2020
f7cdac1
this value is closer to the legacy one
aristath Aug 14, 2020
9da60ff
no reason for the padding to change here since it was already using em
aristath Aug 14, 2020
b61eec5
Update packages/base-styles/_variables.scss
aristath Aug 14, 2020
3828247
Value needs to change since it's now relative to the font-size
aristath Aug 14, 2020
def9b97
Fix calculations for relative units in the gallery block
aristath Aug 14, 2020
9f7228b
Fix social links editor styles
aristath Aug 15, 2020
fe5c2f6
Revert social-icons style mods
aristath Aug 15, 2020
2bbcf37
Merge branch 'master' into aristath/try-relative-units
aristath Aug 17, 2020
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
Prev Previous commit
Next Next commit
Don't use $grid-unit-* vars for front-facing styles
  • Loading branch information
aristath committed Aug 7, 2020
commit 992c777d63d10f8b6bd775d7519a9c3ad3adf0b7
8 changes: 4 additions & 4 deletions packages/block-library/src/buttons/style.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Increased specificity to override blocks default margin.
.wp-block-buttons .wp-block-button {
display: inline-block;
margin-right: $grid-unit-10;
margin-bottom: $grid-unit-10;
margin-right: 0.5rem;
margin-bottom: 0.5rem;

&:last-child {
margin-right: 0;
Expand All @@ -13,7 +13,7 @@
/*rtl:ignore*/
margin-right: 0;
/*rtl:ignore*/
margin-left: $grid-unit-10;
margin-left: 0.5rem;

&:first-child {
margin-left: 0;
Expand All @@ -24,7 +24,7 @@
/*rtl:ignore*/
margin-left: 0;
/*rtl:ignore*/
margin-right: $grid-unit-10;
margin-right: 0.5rem;

&:last-child {
margin-right: 0;
Expand Down
6 changes: 3 additions & 3 deletions packages/block-library/src/columns/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
// As with mobile styles, this must be important since the Column
// assigns its own width as an inline style, which should take effect
// starting at `break-medium`.
flex-basis: calc(50% - #{$grid-unit-20}) !important;
flex-basis: calc(50% - 1rem) !important;
flex-grow: 0;

// Add space between the multiple columns. Themes can customize this if they wish to work differently.
// Only apply this beyond the mobile breakpoint, as there's only a single column on mobile.
&:nth-child(even) {
margin-left: $grid-unit-20 * 2;
margin-left: 2rem;
}
}

Expand All @@ -65,7 +65,7 @@

// When columns are in a single row, add space before all except the first.
&:not(:first-child) {
margin-left: $grid-unit-20 * 2;
margin-left: 2rem;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/cover/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
display: flex;
justify-content: center;
align-items: center;
padding: $grid-unit-20;
padding: 1rem;

&.has-parallax {
background-attachment: fixed;
Expand Down
8 changes: 4 additions & 4 deletions packages/block-library/src/gallery/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
.blocks-gallery-image,
.blocks-gallery-item {
// Add space between thumbnails, and unset right most thumbnails later.
margin: 0 $grid-unit-20 $grid-unit-20 0;
margin: 0 1rem 1rem 0;
display: flex;
flex-grow: 1;
flex-direction: column;
Expand Down Expand Up @@ -84,7 +84,7 @@
// On mobile and responsive viewports, we allow only 1 or 2 columns at the most.
& .blocks-gallery-image,
& .blocks-gallery-item {
width: calc(50% - #{ $grid-unit-20 });
width: calc(50% - 1rem);

&:nth-of-type(even) {
margin-right: 0;
Expand All @@ -102,8 +102,8 @@
@for $i from 3 through 8 {
&.columns-#{ $i } .blocks-gallery-image,
&.columns-#{ $i } .blocks-gallery-item {
width: calc(#{ 100% / $i } - #{ $grid-unit-20 * ( $i - 1 ) / $i });
margin-right: $grid-unit-20;
width: calc(#{ 100% / $i } - #{ 1rem * ( $i - 1 ) / $i });
margin-right: 1rem;
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/latest-posts/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
}

.wp-block-latest-posts__post-excerpt {
margin-top: $grid-unit-10;
margin-bottom: $grid-unit-20;
margin-top: 0.5rem;
margin-bottom: 1rem;
}

.wp-block-latest-posts__featured-image {
Expand Down
9 changes: 4 additions & 5 deletions packages/block-library/src/navigation-link/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

// Styles for submenu flyout
.has-child {
$navigation-vertical-padding: $grid-unit-10 * 0.75;
.wp-block-navigation__container {
border: $border-width solid rgba(0, 0, 0, 0.15);
background-color: inherit;
Expand All @@ -47,7 +46,7 @@
flex-grow: 1;
}
> .wp-block-navigation-link__submenu-icon {
padding-right: $grid-unit-10;
padding-right: 0.5rem;
}
}

Expand All @@ -66,7 +65,7 @@
right: 100%;
height: 100%;
display: block;
width: $grid-unit-10;
width: 0.5rem;
background: transparent;
}
}
Expand Down Expand Up @@ -105,7 +104,7 @@
.wp-block-navigation-link__content {
color: inherit;
text-decoration: none;
padding: $grid-unit-10 $grid-unit-10 * 2;
padding: 0.5rem 1rem;

+ .wp-block-navigation-link__content {
padding-top: 0;
Expand All @@ -124,7 +123,7 @@

.wp-block-navigation-link__submenu-icon {
height: inherit;
padding: $grid-unit-10 * 0.75 $grid-unit-10 * 2;
padding: 0.375rem 1rem;

svg {
fill: currentColor;
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/post-author/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
}

&__avatar {
margin-right: $grid-unit-20;
margin-right: 1rem;
}

&__bio {
margin-bottom: $grid-unit-10;
margin-bottom: 0.5rem;
font-size: 0.7em;
}

Expand Down