mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-29 18:05:19 +00:00
8c63ac7c55
Instead of aligning the edge of the main menu and ToC with the edge of the main menu button, this aligns the text of those sidebar items with the edge of the main menu button. NOTE: Currently not working with the vectorvisualenhancementnext feature flag enabled. This will be addressed in If3aed0ac401b0abc80c3ad52806eb85b33d43f06 Bug: T317583 Change-Id: I01f639c5ca63ac50235dc21ca5273c91213f041c
209 lines
5.5 KiB
Plaintext
209 lines
5.5 KiB
Plaintext
@import '../../common/variables.less';
|
|
@import '../../common/mixins.less';
|
|
|
|
@height-collapsed-toc-button: 36px;
|
|
@padding-top-content-px: unit( @padding-top-content * @font-size-browser, px );
|
|
@selector-collapsed-toc-open: ~'#vector-toc-collapsed-checkbox:checked';
|
|
// Use calc so that the same max width can apply even when the TOC is in different containers
|
|
@max-width-collapsed-toc: 0.85 * @max-width-content-container; // 51em
|
|
|
|
#vector-toc-collapsed-button {
|
|
display: none;
|
|
float: left;
|
|
margin-right: 4px;
|
|
// Reduce vertical padding to fit with page title
|
|
padding: 7px @icon-padding-md-next;
|
|
// Override background color for when the TOC is overlaps content
|
|
// as a sticky element when the page is scrolled down.
|
|
background-color: @background-color-base;
|
|
|
|
&:hover,
|
|
&:active {
|
|
background-color: @colorGray15;
|
|
}
|
|
|
|
.vector-feature-visual-enhancement-next-disabled & {
|
|
.mixin-vector-flush-left-margin-left();
|
|
// Reduce vertical padding to fit with page title
|
|
padding-left: @icon-padding-md;
|
|
padding-right: @icon-padding-md;
|
|
}
|
|
}
|
|
|
|
#vector-toc-collapsed-button,
|
|
.sidebar-toc {
|
|
z-index: @z-index-menu;
|
|
}
|
|
|
|
.ve-active {
|
|
#vector-toc-collapsed-button {
|
|
display: none !important; /* stylelint-disable-line declaration-no-important */
|
|
}
|
|
}
|
|
|
|
// Styles for the "move to sidebar/hide" buttons, hidden by default.
|
|
.vector-toc-collapse-button,
|
|
.vector-toc-uncollapse-button {
|
|
display: none;
|
|
border: 0;
|
|
padding: 0;
|
|
background-color: transparent;
|
|
color: @color-primary;
|
|
cursor: pointer;
|
|
|
|
&:hover {
|
|
color: @color-primary--hover;
|
|
}
|
|
|
|
&:before {
|
|
content: '@{msg-brackets-start}';
|
|
color: @color-base--subtle;
|
|
}
|
|
|
|
&:after {
|
|
content: '@{msg-brackets-end}';
|
|
color: @color-base--subtle;
|
|
}
|
|
}
|
|
|
|
// Shared collapsed TOC styles, applies across all collapsed cases (header, floating, sticky header)
|
|
.mixin-toc-collapsed() {
|
|
// T316056 Remove TOC menu fixed width and apply min/max-width
|
|
// using min() so that the TOC menu doesn't fully cover the text even on small viewports
|
|
width: auto;
|
|
min-width: 200px;
|
|
max-width: ~'min( @{max-width-collapsed-toc}, 75vw )'; // 51em
|
|
}
|
|
|
|
// TOC styles when collapsed to header
|
|
.mixin-toc-collapsed-header() {
|
|
#vector-toc-collapsed-button {
|
|
display: block;
|
|
}
|
|
|
|
.vector-sticky-toc-container {
|
|
// Override TOC container's sticky positioning
|
|
position: relative;
|
|
}
|
|
|
|
.sidebar-toc {
|
|
.mixin-toc-collapsed();
|
|
display: none;
|
|
position: absolute;
|
|
top: @height-collapsed-toc-button; // TOC button height
|
|
left: -@icon-padding-md;
|
|
margin-top: @padding-top-content-px; // Account for padding-top from .mw-body
|
|
// FIXME: Collapsed TOC styles are not consistent with other vector dropdowns
|
|
border: @border-width-base @border-style-base @border-color-base;
|
|
}
|
|
|
|
.vector-feature-visual-enhancement-next-disabled {
|
|
.sidebar-toc {
|
|
margin-left: 0;
|
|
margin-right: 0;
|
|
}
|
|
}
|
|
|
|
@{selector-collapsed-toc-open} ~ .mw-table-of-contents-container .sidebar-toc {
|
|
// Hide the TOC when the button is not checked
|
|
display: block;
|
|
}
|
|
}
|
|
|
|
// TOC styles when collapsed to floating button
|
|
.mixin-toc-collapsed-floating() {
|
|
#vector-toc-collapsed-button {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
margin: 0;
|
|
}
|
|
|
|
.sidebar-toc {
|
|
.mixin-toc-collapsed();
|
|
position: fixed;
|
|
left: 6px;
|
|
}
|
|
}
|
|
|
|
@media ( max-width: @max-width-tablet ) {
|
|
//
|
|
// Collapsed to header on narrow screens
|
|
//
|
|
.mixin-toc-collapsed-header();
|
|
|
|
//
|
|
// Collapsed to floating button on narrow screens when below page title
|
|
//
|
|
.vector-below-page-title {
|
|
.mixin-toc-collapsed-floating();
|
|
}
|
|
}
|
|
|
|
@media ( min-width: @min-width-desktop ) {
|
|
@supports ( display: grid ) {
|
|
.client-js {
|
|
.vector-toc-collapsed:not( .vector-sticky-header-visible ) {
|
|
//
|
|
// Collapsed to header
|
|
//
|
|
.mixin-toc-collapsed-header();
|
|
|
|
.mw-table-of-contents-container {
|
|
grid-area: content;
|
|
}
|
|
|
|
//
|
|
// Collapsed to floating icon when below page title
|
|
//
|
|
.vector-below-page-title& {
|
|
.mixin-toc-collapsed-floating();
|
|
}
|
|
|
|
// Disable left and right margin
|
|
.sidebar-toc {
|
|
margin-left: 0;
|
|
margin-right: 0;
|
|
}
|
|
}
|
|
|
|
// Show the "move to sidebar/hide" buttons
|
|
.vector-toc-collapsed .vector-toc-uncollapse-button,
|
|
.vector-toc-not-collapsed .vector-toc-collapse-button {
|
|
display: inline-block;
|
|
}
|
|
}
|
|
|
|
.vector-toc-collapsed.vector-feature-visual-enhancement-next-disabled:not( .vector-sticky-header-visible ) {
|
|
.sidebar-toc {
|
|
margin-left: 0;
|
|
margin-right: 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// Collapsed to sticky header
|
|
//
|
|
.vector-toc-collapsed .vector-sticky-header-toc-container .sidebar-toc {
|
|
margin-left: 0;
|
|
margin-right: 0;
|
|
.mixin-toc-collapsed();
|
|
// T316056 Use max-content because collapsed TOC is absolutely positioned, width is relative to the collapsed TOC button
|
|
// max-content doesn't account for padding even when we use box-sizing, so use content-box instead
|
|
// and manually account for horizontal padding in the max width
|
|
box-sizing: content-box;
|
|
width: max-content;
|
|
@sidebar-toc-left-padding-em: unit( @sidebar-toc-left-padding / @font-size-browser, em );
|
|
@sidebar-toc-right-padding-em: unit( @sidebar-toc-right-padding / @font-size-browser, em );
|
|
|
|
@max-width-sticky-header-collapsed-toc: @max-width-collapsed-toc - @sidebar-toc-left-padding-em - @sidebar-toc-right-padding-em;
|
|
@max-width-sticky-header-collapsed-toc-next: @max-width-collapsed-toc - @sidebar-toc-right-padding-em;
|
|
max-width: ~'min( @{max-width-sticky-header-collapsed-toc}, 75vw )'; // min( 48.5625em, 75vw )
|
|
|
|
.vector-feature-visual-enhancement-next-enabled & {
|
|
max-width: ~'min( @{max-width-sticky-header-collapsed-toc-next}, 75vw )';
|
|
}
|
|
}
|