Skip to content

Commit

Permalink
Site Editor: fix app header on small-medium screens (#27310)
Browse files Browse the repository at this point in the history
Especially in contexts with the navigation sidebar open

Fixes #27245 #26754
  • Loading branch information
mattwiebe authored Nov 27, 2020
1 parent 33d0366 commit 2370863
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 37 deletions.
1 change: 0 additions & 1 deletion packages/base-styles/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ $mobile-header-toolbar-height: 44px;
$mobile-floating-toolbar-height: 44px;
$mobile-floating-toolbar-margin: 8px;
$mobile-color-swatch: 48px;
$header-toolbar-min-width: 335px;

/**
* Shadows.
Expand Down
40 changes: 11 additions & 29 deletions packages/edit-site/src/components/header/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,27 @@
height: $header-height;
box-sizing: border-box;
width: 100%;
justify-content: space-between;

@include break-medium() {
padding-left: 60px;
transition: padding-left 20ms linear;
transition-delay: 80ms;
@include reduce-motion("transition");
body.is-fullscreen-mode & {
padding-left: 60px;
transition: padding-left 20ms linear;
transition-delay: 80ms;
@include reduce-motion("transition");
}

}

.edit-site-header_start,
.edit-site-header_end {
flex: 1 0;
display: flex;
}

@include break-medium() {
.edit-site-header_start {
// Flex basis prevents the header_start toolbar
// from collapsing when shrinking the viewport.
flex-basis: calc(#{$header-toolbar-min-width} - #{$header-height});
}

.edit-site-header_end {
// Flex basis prevents the header_end toolbar
// from collapsing when shrinking the viewport
flex-basis: $header-toolbar-min-width;
}
}

.edit-site-header_center {
display: flex;
align-items: center;
height: 100%;
flex-shrink: 1;
// Flex items will, by default, refuse to shrink below a minimum
// intrinsic width. In order to shrink this flexbox item, and
// subsequently truncate child text, we set an explicit min-width.
Expand All @@ -56,20 +44,14 @@ body.is-navigation-sidebar-open {
padding-left: 0;
transition: padding-left 20ms linear;
transition-delay: 0ms;

.edit-site-header_start {
flex-basis: $header-toolbar-min-width;
}
}
}

// Centred document title on small screens with sidebar open
@media ( max-width: #{ ($break-medium - 1) } ) {
@media ( max-width: #{ ($break-large - 1) } ) {
body.is-navigation-sidebar-open .edit-site-header {
.edit-site-header_start {
flex-basis: 0;
}
.block-editor-post-preview__button-toggle {
.edit-site-header-toolbar__inserter-toggle ~ .components-button,
.edit-site-header_end .components-button:not(.is-primary) {
display: none;
}
.edit-site-save-button__button {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
.edit-site-navigation-toggle {
align-items: center;
background: $gray-900;
border-radius: 0;
display: none;
position: absolute;
z-index: z-index(".edit-site-navigation-toggle");
height: $header-height + $border-width; // Cover header border
width: $header-height;

@include break-medium() {
align-items: center;
background: $gray-900;
border-radius: 0;
display: flex;
position: absolute;
z-index: z-index(".edit-site-navigation-toggle");
height: $header-height + $border-width; // Cover header border
width: $header-height;
}

body.is-navigation-sidebar-open & {
display: flex;
}
}

Expand Down

0 comments on commit 2370863

Please sign in to comment.