mediawiki-skins-Vector/resources/skins.vector.styles/layouts/grid.less
bwang e90b7e341f Add ColumnEnd.mustache and new grid styles to support third column
Bug: T317897
Depends-On: Ibf304843a62d5269992a01eb826edf71ce8d3c35
Depends-On: Ib424ca1c767161fdae8c0aeedfe662b7fa039ff6
Change-Id: Ie7d31df972ff68313b2437ff14b7b6b8d7078204
2022-11-09 11:54:30 -06:00

144 lines
4 KiB
Plaintext

//
// Grid layout
//
@width-sidebar-end: unit( 185px / @font-size-browser, em );
@media ( min-width: @min-width-desktop ) {
.mw-page-container-inner {
display: grid;
width: 100%;
column-gap: 8px; // 8px + 12px (.mw-body padding-left) = 20px total spacing
grid-template: ~'min-content min-content min-content 1fr min-content / 232px minmax(0, 1fr)';
grid-template-areas: 'header header'
'siteNotice siteNotice'
'mainMenu pageContent'
'toc pageContent'
'footer footer';
}
.vector-sitenotice-container {
grid-area: siteNotice;
}
.mw-table-of-contents-container {
grid-area: toc;
}
.mw-header {
grid-area: header;
}
.vector-main-menu-container {
grid-area: mainMenu;
}
.mw-content-container {
grid-area: pageContent;
}
.mw-footer-container {
grid-area: footer;
}
}
@media ( min-width: @min-width-desktop-wide ) {
.mw-page-container-inner {
/* Use of minmax is important to restrict the maximum grid column width
more information: T314756 */
grid-template-columns: ~'284px minmax(0, 1fr)';
}
}
.mixin-horizontally-centered() {
grid-column: mainMenu / pageContent;
margin-left: auto;
margin-right: auto;
width: 100%;
box-sizing: border-box;
}
.mw-content-container,
.mw-table-of-contents-container {
.vector-feature-page-tools-disabled & {
max-width: @max-width-content-container;
}
// For container logic specific to special pages and history pages.
// FIXME: Remove `.skin-vector-disable-max-width` when caching no longer an issue.
.vector-feature-limited-width-disabled &,
.vector-feature-limited-width-content-disabled &,
.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 .vector-page-toolbar-container intentionally
// to support easier navigation between tabs.
// See T293441 for further information on that.
// Both rules are !important as they are final. Max-width on a page should be restored by removing the `skin-vector-disable-max-width`,
// preferably by modification to the feature flag VectorMaxWidthOptions. Code should never attempt to override this rule.
/* stylelint-disable-next-line declaration-no-important */
max-width: none !important;
/* stylelint-disable-next-line declaration-no-important */
width: 100% !important;
}
}
// Our usage of grid to position the ToC when it is collapsed in the page title
// requires us to manually define the max width depending on the number of columns.
// This also requires us to define a set width for the sidebar end column
// FIXME: Remove this max-width mess with T318013
@{selector-sidebar-no-toc-sidebar-closed} ~ .mw-content-container {
.mixin-horizontally-centered();
max-width: @max-width-content-container;
.vector-feature-page-tools-enabled.vector-page-tools-pinned & {
max-width: @max-width-content-container + @width-sidebar-end;
}
}
.vector-toc-collapsed @{selector-main-menu-closed} {
& ~ .mw-content-container,
& ~ .mw-table-of-contents-container {
.mixin-horizontally-centered();
max-width: @max-width-content-container;
.vector-feature-page-tools-enabled.vector-page-tools-pinned& {
max-width: @max-width-content-container + @width-sidebar-end;
}
}
}
@media ( min-width: @min-width-desktop ) {
.vector-feature-page-tools-enabled .mw-body {
display: grid;
grid-auto-rows: auto;
grid-template-columns: ~'minmax(0, @{max-width-content-container}) min-content';
grid-template-areas: 'titlebar .'
'toolbar columnEnd'
'content columnEnd';
// FIXME: Remove `.skin-vector-disable-max-width` when caching no longer an issue.
.vector-feature-limited-width-disabled&,
.vector-feature-limited-width-content-disabled&,
.skin-vector-disable-max-width& {
grid-template-columns: ~'1fr min-content';
}
.vector-page-titlebar {
grid-area: titlebar;
}
.vector-page-toolbar {
grid-area: toolbar;
}
#bodyContent {
grid-area: content;
}
.vector-column-end {
grid-area: columnEnd;
}
}
}