mediawiki-skins-Vector/resources/skins.vector.styles/components/TableOfContents.less
bwang 42f863a936 TOC: CSS clean up and spacing fix
- Update TOC bottom padding to match spec in T304166.
  Before (30px): https://phabricator.wikimedia.org/F35312302
  After (20px): https://phabricator.wikimedia.org/F35312299
- Rearrange/combine some selectors in TableOfContents.less
- Delete some unnecessary styles/selectors
- Rename variables in TableOfContents.less

Change-Id: Ifffc434dcab4256a0c3ae8faf43a342935b820ff
2022-07-08 19:36:19 +00:00

130 lines
2.9 KiB
Plaintext

@import '../../common/variables.less';
@sidebar-toc-fade-height: 30px;
@sidebar-toc-vertical-padding: 20px;
@sidebar-toc-right-padding: 12px;
@toc-subsection-toggle-icon-size: 1.834em;
.sidebar-toc {
max-height: 75vh;
padding: @sidebar-toc-vertical-padding @sidebar-toc-right-padding @sidebar-toc-vertical-padding 32px;
box-sizing: border-box;
overflow: auto;
background-color: @border-color-sidebar;
.sidebar-toc-header {
padding-bottom: 12px;
}
.sidebar-toc-title {
color: @color-base--subtle;
font-size: @font-size-base;
margin: 0;
padding: 0;
border: 0;
}
.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;
cursor: pointer;
}
.sidebar-toc-link {
word-break: break-word;
color: @color-link;
}
.sidebar-toc-list-item-active > .sidebar-toc-link {
// Highlight active section
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;
}
}
}
// T302076 Add scrollable indicator as fade
.sidebar-toc:after {
content: '';
display: block;
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: @sidebar-toc-fade-height;
background: linear-gradient( rgba( 255, 255, 255, 0 ), @border-color-sidebar );
background-repeat: no-repeat;
background-position: -@sidebar-toc-right-padding; // T311436 Hacky way to prevent the fade from covering the scrollbar
pointer-events: none; // Make the link below the fade clickable
}
// 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 );
}
// T300975 following media query for TOC experiment treatment
// class can be removed once associated A/B test is over.
@media ( max-width: @max-width-tablet ) {
.skin-vector-toc-experiment-treatment #toc {
display: table;
}
}