Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site Editor: fix app header on small-medium screens #27310

Merged
merged 4 commits into from
Nov 27, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the only place that variable is used. Which means it can be removed from the _variables.scss stylesheet in base-styles now. See also #26827.

}
}

.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