mediawiki-skins-Vector/resources/skins.vector.styles/layouts/grid.less
Jon Robson e8130d6628 Layout: Fixes table of contents alignment issues
This patch also adds some grid variables to be reused

Bug: T311793
Change-Id: Ib985e929b5ff013dfe9dcff1d0f33cebc24bbed6
2022-07-05 21:11:47 +00:00

110 lines
2.5 KiB
Plaintext

//
// Grid layout
//
@height-header: 66px;
@width-gutter: 20px;
@padding-top-footer: 50px;
// 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-left: 8px;
}
.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%;
}
}
.mw-footer-container {
padding-top: @padding-top-footer;
padding-bottom: 82px;
}
@media ( max-width: @max-width-tablet ) {
.mw-header {
// Match header styles applied by grid-template-rows and row-gap
// when grid is disabled on lower resolutions
height: @height-header;
margin-bottom: @grid-row-gap;
}
}
@media ( min-width: @min-width-desktop ) {
.mw-page-container-inner {
display: grid;
width: 100%;
grid-template: ~'@{height-header} min-content 1fr min-content / 232px @{width-gutter} minmax(0, 1fr)';
grid-template-areas: 'header header header'
'sidebar gutter content'
'toc gutter content'
'footer footer footer';
row-gap: @grid-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;
}
// with sidebar closed, when no table of contents, align with hamburger menu
@{selector-sidebar-no-toc-sidebar-closed} ~ .mw-content-container {
.mixin-column-align-width-hamburger-icon();
}
.mw-footer-container {
grid-area: footer;
padding-top: @padding-top-footer - @grid-row-gap;
}
}
@media ( min-width: @min-width-desktop-wide ) {
.mw-page-container-inner {
grid-template-columns: ~'284px @{width-gutter} 1fr';
}
}
@{selector-sidebar-no-toc-sidebar-closed} {
& ~ .mw-content-container {
.mixin-column-full-width();
}
}
}