mediawiki-skins-Vector/resources/skins.vector.styles/layouts/grid.less

127 lines
3 KiB
Plaintext
Raw Normal View History

//
// 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 {
.mw-content-container {
max-width: @max-width-content-container;
// For container logic specific to special pages and history pages.
.skin-vector-disable-max-width & {
// Allow the max-width of content on history/special pages to be wider than
// the max-width of content on article pages.
// Note, we don't disable the max-width on .mw-article-toolbar-container intentionally
// to support easier navigation between tabs.
// See T293441 for further information on that.
max-width: none;
width: 100%;
}
}
@padding-top-footer: 50px;
.mw-footer-container {
padding-top: @padding-top-footer;
padding-bottom: 82px;
}
@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 ) {
@row-gap: 24px;
.mw-page-container-inner {
display: grid;
width: 100%;
grid-template: ~'66px min-content 1fr min-content / 232px 20px minmax(0, 1fr)';
grid-template-areas: 'header header header'
'sidebar gutter content'
'toc gutter content'
'footer footer footer';
row-gap: @row-gap;
}
.mw-body {
padding-left: 0;
}
.mw-table-of-contents-container {
grid-area: toc;
}
.mw-header {
grid-area: header;
}
.vector-sidebar-container {
grid-area: sidebar;
}
.mw-content-container {
grid-area: content;
}
.mw-footer-container {
grid-area: footer;
padding-top: @padding-top-footer - @row-gap;
}
}
@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();
}
}
}