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 Aug 27, 2021
1 parent 662dabc commit 126b63d
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions packages/block-library/src/navigation/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -199,35 +199,22 @@

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

// Menu items with no background.
.wp-block-page-list,
.wp-block-page-list > .wp-block-navigation-item,
.wp-block-navigation__container > .wp-block-navigation-item {
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-navigation-item,
.wp-block-navigation__container > .wp-block-navigation-item {
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 @@ -347,7 +334,6 @@
align-items: flex-end;

.wp-block-navigation-item {
margin-right: 0;
justify-content: flex-end;
}
}
Expand Down

0 comments on commit 126b63d

Please sign in to comment.