Skip to content

Commit

Permalink
Let the menu grow (#8756)
Browse files Browse the repository at this point in the history
* Let the menu grow

This PR lets the menu grow to accommodate long text. Already now in Spanish, the "Code Editor" wraps having to fit both the spanish label and keyboard shortcut. As we add more keyboard shortcuts as well as hints, we need to let the menu grow to accommodate that, up to the mobile breakpoint in width.

This PR accomplishes that using auto widths, nowrap whitespace, and a little Nacin' Spacin' thrown in for code cleanup while I was there.

* Add case for mobile

* Try and clarify comment.
  • Loading branch information
jasmussen authored Aug 16, 2018
1 parent 966175f commit c3211fa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
8 changes: 8 additions & 0 deletions packages/components/src/menu-item/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,19 @@
// !important allows icons from plugins to be overriden and given a dark-gray fill
fill: $dark-gray-900 !important;
}

// Don't wrap text until viewport is beyond the mobile breakpoint.
@include break-mobile() {
.components-popover:not(.is-mobile) & {
white-space: nowrap;
}
}
}

.components-menu-item__shortcut {
opacity: 0.5;
margin-right: 0;
margin-left: auto;
align-self: center;
padding-left: 8px;
}
8 changes: 7 additions & 1 deletion packages/components/src/popover/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,15 @@ $arrow-size: 8px;

.components-popover:not(.is-mobile) & {
position: absolute;
min-width: 260px;
height: auto;
overflow-y: auto;

// Let the menu scale to fit items.
@include break-mobile() {
width: auto;
min-width: 260px;
max-width: $break-mobile;
}
}

.components-popover:not(.is-mobile).is-top & {
Expand Down
6 changes: 4 additions & 2 deletions packages/editor/src/components/block-switcher/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
}
}

.editor-block-switcher__popover .components-popover__content {
width: 300px;
.components-popover:not(.is-mobile).editor-block-switcher__popover .components-popover__content {
min-width: 320px;
}

.editor-block-switcher__popover .components-popover__content {
@include break-medium {
position: relative;

Expand Down

0 comments on commit c3211fa

Please sign in to comment.