mediawiki-skins-Vector/resources/skins.vector.styles/components/TableOfContents.less
bwang af21dec1c1 Factor out TableOfContentsPinned.less and rename TableOfContentsCollapsed for better CSS organization
Bug: T324877
Change-Id: I93182573a2ae718589ec7d448dd97a160ecd81a2
2023-01-04 11:24:57 -05:00

123 lines
2.9 KiB
Plaintext

@import '../../common/variables.less';
.sidebar-toc {
max-height: 75vh;
padding: @sidebar-toc-vertical-padding @sidebar-toc-right-padding @sidebar-toc-vertical-padding @sidebar-toc-left-padding;
box-sizing: border-box;
overflow-y: auto;
overflow-x: hidden;
background-color: @background-color-page-container;
.vector-feature-page-tools-disabled & .vector-toc-pinnable-header {
// Override default pinnable header styles
padding: 0 0 12px 0;
border: 0;
line-height: initial;
}
.vector-pinnable-header-label {
// Override heading element styles in elements.less
overflow: unset;
}
.sidebar-toc-numb {
display: none;
}
.sidebar-toc-toggle {
// For no-js users, toggling is disabled and icon is hidden
display: none;
position: absolute;
top: 1px; // visually center icon
left: ~'calc( -1 * @{toc-subsection-toggle-icon-size} - 1px )'; // leaves 6px between icon + text
width: @toc-subsection-toggle-icon-size; // ~22px @ 12
height: @toc-subsection-toggle-icon-size;
font-size: 0.75em; // reduces size of toggle icon to 12px @ 16
transition: @transition-duration-base;
color: transparent;
cursor: pointer;
}
.sidebar-toc-link {
word-break: break-word;
color: @color-link;
display: block;
}
// Highlight and bold active sections, active top sections that are unexpanded
// and active top sections that are the only active element.
.sidebar-toc-list-item-active,
.sidebar-toc-level-1-active:not( .sidebar-toc-list-item-expanded ),
.sidebar-toc-list-item-active.sidebar-toc-level-1-active {
> .sidebar-toc-link {
// Highlight active section
color: @color-base;
font-weight: bold;
.sidebar-toc-text {
// Increase width to prevent line wrapping due to bold text
// Avoid applying on link element to avoid focus indicator changing size
width: ~'calc( 100% + @{sidebar-toc-right-padding} )';
}
}
}
// Highlight active top sections that contain an active section
.sidebar-toc-level-1-active:not( .sidebar-toc-list-item-active ) > .sidebar-toc-link {
color: @color-base;
}
.sidebar-toc-text {
padding: 4px 0;
}
.sidebar-toc-contents,
.sidebar-toc-list {
margin: 0;
list-style: none;
line-height: 18px;
}
.sidebar-toc-list-item {
display: block;
position: relative;
list-style-type: none;
padding-left: 8px;
&.sidebar-toc-level-1 {
padding-left: 0;
}
a {
font-size: @font-size-base;
}
}
}
// Collapse ToC sections by default, excluding no-js
.client-js .sidebar-toc {
.sidebar-toc-level-1 .sidebar-toc-list-item {
display: none;
}
.sidebar-toc-level-1.sidebar-toc-list-item-expanded .sidebar-toc-list-item {
display: block;
}
.sidebar-toc-toggle {
display: block;
}
.sidebar-toc-level-1.sidebar-toc-list-item-expanded .sidebar-toc-toggle {
transform: rotate( 0deg );
}
}
.client-js body.ltr .sidebar-toc .sidebar-toc-toggle {
transform: rotate( -90deg );
}
.client-js body.rtl .sidebar-toc .sidebar-toc-toggle {
transform: rotate( 90deg );
}