mediawiki-skins-Vector/resources/skins.vector.styles/layouts/grid.less
bwang 8a88f61e89 Introduce media query breakpoint variables and replace all media query usage with new variables
Pixel shows 15 regressions, these are expected changes that are
fixing issues on specific viewports that fixes the following:

[At exactly the tablet breakpoint]
* the more menu dropdown was being
shown at the same time as the other menu items, resulting in duplicates
(see https://phabricator.wikimedia.org/F35285379)

[At exactly the desktop breakpoint]
* The table of contents AND the
table of contents toggle button to the left of the title were showing
(see https://phabricator.wikimedia.org/F35285392)
* The sticky header was not showing
* The fly out table of contents was showing instead of the sidebar
table of contents on scroll
* The top of the sidebar is brought into alignment with the tabs
(see https://phabricator.wikimedia.org/F35285408)

Bug: T310536
Change-Id: I6e870a032c8ba4ec003d00ff3f91732aaa2f38b0
2022-06-28 23:19:52 +00:00

101 lines
2.3 KiB
Plaintext

//
// Grid layout
//
// Makes a column span entire page
.mixin-column-full-width() {
grid-column: sidebar / content;
margin-left: auto;
margin-right: auto;
// Needed for minimal content e.g. one word articles.
width: 100%;
box-sizing: border-box;
}
// aligns left side of column with hamburger icon.
.mixin-column-align-width-hamburger-icon() {
// Align the content with the hamburger icon
padding: 0 0 0 @margin-horizontal-sidebar-button-icon;
}
.vector-layout-grid {
@media ( max-width: @max-width-mobile ) {
.mw-header {
// Should match grid-template-rows definition below.
height: 66px;
// Should match row-gap below.
margin-bottom: 24px;
}
}
@media ( min-width: @min-width-tablet ) {
.mw-page-container-inner {
display: grid;
width: 100%;
grid-template: ~'66px auto 1fr / 232px 20px minmax(0, 1fr)';
grid-template-areas: 'header header header'
'sidebar gutter content'
'footer footer footer';
row-gap: 24px;
}
.mw-body {
padding-left: 0;
}
.mw-header {
grid-area: header;
}
.vector-sidebar-container {
grid-area: sidebar;
}
.mw-content-container {
grid-area: content;
}
.mw-footer-container {
grid-area: footer;
}
}
@media ( min-width: @min-width-desktop ) {
.mw-page-container-inner {
grid-template-columns: ~'284px 20px 1fr';
}
}
/**
* Special handling for sidebar when table of contents is visible.
* This only applies between the tablet and desktop breakpoints.
* It shouldn't apply on mobile as it will lead to misalignment with the hamburger icon.
* Cover the cases where:
* 1) the main menu is closed, there is no TOC in the sidebar
* 2) the main menu is closed, the sidebar TOC is hidden at the breakpoint.
* In these situation content should span the entire page.
*/
@media ( min-width: ( @min-width-tablet ) ) and ( max-width: @max-width-tablet ) {
@{selector-sidebar-container-sidebar-closed} {
.mw-navigation {
display: none;
}
& + .mw-content-container {
.mixin-column-full-width();
.mixin-column-align-width-hamburger-icon();
}
}
}
@{selector-sidebar-no-toc-sidebar-closed} {
& + .mw-content-container {
.mixin-column-full-width();
@media ( min-width: ( @min-width-tablet ) ) and ( max-width: @max-width-tablet ) {
.mixin-column-align-width-hamburger-icon();
}
}
}
}