Skip to content

Commit

Permalink
Allow both shortcuts and icons.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasmussen committed Aug 28, 2020
1 parent 165537e commit 4826cbe
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 20 deletions.
4 changes: 0 additions & 4 deletions packages/components/src/dropdown-menu/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,3 @@
}
}
}

.components-dropdown-menu__menu.no-icons .components-menu-item__button.components-button {
padding: 0 $grid-unit-15;
}
1 change: 1 addition & 0 deletions packages/components/src/menu-group/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

.components-menu-group__label {
padding: 0 $grid-unit-10;
margin-top: $grid-unit-05;
margin-bottom: $grid-unit-15;
color: $gray-700;
text-transform: uppercase;
Expand Down
10 changes: 4 additions & 6 deletions packages/components/src/menu-item/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,10 @@ export function MenuItem(
{ ...props }
>
{ children }
{ ! icon && (
<Shortcut
className="components-menu-item__shortcut"
shortcut={ shortcut }
/>
) }
<Shortcut
className="components-menu-item__shortcut"
shortcut={ shortcut }
/>
{ icon && <Icon icon={ icon } /> }
</Button>
);
Expand Down
16 changes: 6 additions & 10 deletions packages/components/src/menu-item/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@
.components-menu-item__button.components-button {
width: 100%;

// Target plugin icons that can have arbitrary classes by using an aggressive selector.
// @todo: is this still necessary?
.dashicon,
.components-menu-items__item-icon,
svg.components-menu-items__item-icon,
> span > svg {
margin-right: 0;
margin-left: auto;
}

.components-menu-items__item-icon {
margin-right: -$grid-unit-05; // This optically balances the icon.
margin-left: auto;
display: inline-block;
flex: 0 0 auto;
}

.components-menu-item__shortcut + .components-menu-items__item-icon {
margin-left: $grid-unit-10;
}
}

.components-menu-item__info-wrapper {
Expand Down

0 comments on commit 4826cbe

Please sign in to comment.