mediawiki-skins-MinervaNeue/resources/skins.minerva.base.styles/content/toc.less
Jan Drewniak 59fd0cd5dc Convert all color related Less variables to CSS custom properties
All colors used in Minerva are converted from Less variables
into CSS custom properties. A new file called CSSCustomProperties.less
is created in the skins.minerva.base.styles module to store
these custom properties and an ADR is provided on the rationale for
dropping support for browsers that don't support custom properties.

The new CSS custom properties follow Codex design token conventions
where possible (and noted when not).

Link colors are unique because their styles are defined in core,
so in that case the Less variables values are set to custom properties.
Those values are then fed back into MediaWiki core for core link
styling.

Also adds a temporary night-mode color palette under the
.skin-nightmode-1 class on the <html> element.

Bug: T356074
Change-Id: Ida1f14138f12bd3c600c264bde7b5100f9dbf4ff
2024-02-02 17:57:27 +00:00

103 lines
2 KiB
Plaintext

@import '../../../minerva.less/minerva.variables.less';
@toc-large-icon: 44px;
@toc-small-icon: 34px;
.toc {
display: none;
position: relative;
margin: 1em 0;
padding: 0 1em 1em 1em;
background-color: var( --background-color-interactive-subtle );
border: @border-width-base @border-style-base #eaecf0;
box-sizing: border-box;
// We need high specificity to override .content ul
&.toc > ul {
// Account for the icon spaces left and right.
// margin: 0 @toc-small-icon 0 @toc-large-icon;
font-size: @font-size-minerva-small;
// Reset `.client-js .toc > ul`.
padding-left: 0;
}
// We need high specificity to override .content ul
&.toc ul {
list-style: none;
// break long headings like urls
word-break: break-word;
}
}
.toctitle {
@toctitle-vertical-padding: 1.4em / 2;
font-weight: bold;
display: flex;
// Force vertical centering on title by making this full height
align-items: center;
// Ensure height for icon
min-height: @toc-large-icon;
// We need high specificity to override .content h2
&.toctitle h2 {
display: inline-block;
font-family: @font-family-base;
font-size: unit( 18/16, em );
vertical-align: middle;
flex-grow: 1;
margin-left: @toc-large-icon;
margin-right: @toc-large-icon;
}
}
.tocnumber {
display: none;
}
.toctogglelabel {
position: absolute;
left: 0;
top: 0;
right: 0;
height: @toc-large-icon;
z-index: @z-index-above-content;
}
// Do stuff we only need to do with JS
// Collapsing and reserving space for the JS icons
.client-js .toc {
// Reset padding, because we need to reserve space for icons
padding: 0;
> ul {
// Account for the icon spaces left and right.
margin: 0 @toc-small-icon 0 @toc-large-icon;
}
.toctogglecheckbox ~ ul {
visibility: hidden;
height: 0;
}
.toctogglecheckbox:checked ~ ul {
visibility: visible;
padding-bottom: 20px;
height: auto;
}
.toctogglelabel {
cursor: pointer;
}
}
@media screen and ( min-width: @width-breakpoint-tablet ) {
.toc {
// Reset the rule for mobile mode
display: table;
.toctitle {
visibility: visible;
}
}
}