Skip to content

Commit

Permalink
Use gap instead of margin.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasmussen committed Jun 1, 2021
1 parent abdb635 commit 1643568
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions packages/block-library/src/navigation/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -210,35 +210,22 @@

/**
* Margins
* @todo: refactor this to use gap.
*/

// Menu items with no background.
.wp-block-page-list,
.wp-block-page-list > .wp-block-pages-list__item,
.wp-block-navigation__container > .wp-block-navigation-link {
margin: 0 2em 0 0;

// Margin of right-most margin should be zero, for right aligned or justified items.
&:last-child {
margin-right: 0;
}
.wp-block-navigation__container .wp-block-page-list,
.wp-block-navigation__container {
gap: 0.5em 2em;
}

// Menu items with background.
// We use :where to keep specificity minimal, yet still scope it to only the navigation block.
// That way if padding is set in theme.json, it still wins.
// https://css-tricks.com/almanac/selectors/w/where/
.wp-block-navigation:where(.has-background) {
.wp-block-page-list,
.wp-block-page-list > .wp-block-pages-list__item,
.wp-block-navigation__container > .wp-block-navigation-link {
margin: 0 0.5em 0 0;

// Don't show right margin on the last child.
&:last-child {
margin: 0;
}
.wp-block-navigation__container .wp-block-page-list,
.wp-block-navigation__container {
gap: 0 0.5em;
}
}

Expand Down Expand Up @@ -330,7 +317,6 @@

// Vertical layout
.is-vertical & {
display: block;
flex-direction: column;
align-items: flex-start;
}
Expand Down Expand Up @@ -360,7 +346,6 @@

.wp-block-navigation-link,
.wp-block-pages-list__item {
margin-right: 0;
justify-content: flex-end;
}
}
Expand Down

0 comments on commit 1643568

Please sign in to comment.