mediawiki-skins-Vector/resources/skins.vector.styles/components/TableOfContentsCollapsed.less
Clare Ming 1d1585d214 Add feature to hide/show collapsible TOC above desktop
- Add hide/show links to TOC template.
- Add i18n messages for hide/show text.
- Add event listener to TOC js.
- Update relevant TOC collapsed styles.
- Update test snapshot.

Bug: T307901
Change-Id: Ic94fda79bd14856ccda14985d5860aa54d3118d0
2022-07-29 14:19:55 -05:00

139 lines
2.7 KiB
Plaintext

@import '../../common/variables.less';
@selector-collapsed-toc-closed: ~'#vector-toc-collapsed-checkbox:not( :checked )';
#vector-toc-collapsed-button {
display: none;
float: left;
margin-right: 4px;
margin-left: -@icon-padding-md;
// Reduce padding to fit with page title
padding: 7px 10px 7px 10px;
// 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-toc-collapsed-button,
.sidebar-toc {
z-index: @z-index-menu;
}
.mixin-collapse-toc-page-title {
#vector-toc-collapsed-button {
display: block;
}
.mw-table-of-contents-container {
position: relative;
.vector-layout-legacy & {
// !important needed to override rules in screen.less
top: 0 !important; /* stylelint-disable-line declaration-no-important */
}
}
.sidebar-toc {
position: absolute;
top: 44px;
left: -2px;
// !important needed to override rules in Sidebar.less
margin: 0 !important; /* stylelint-disable-line declaration-no-important */
// Dropdown styles
border: @border-width-base @border-style-base @border-color-base;
// Remove TOC fade
&:after {
display: none;
}
}
@{selector-collapsed-toc-closed} ~ .mw-table-of-contents-container .sidebar-toc {
// Hide the TOC when the button is not checked
display: none;
}
}
// Override button styles for the "move to sidebar/hide" links. Default hide.
.vector-toc-collapse-button,
.vector-toc-uncollapse-button {
display: none;
border: 0;
padding: 0;
background-color: transparent;
color: @color-primary;
&:hover {
color: @color-primary--hover;
}
&:before {
content: '@{msg-brackets-start}';
color: @color-base--subtle;
}
&:after {
content: '@{msg-brackets-end}';
color: @color-base--subtle;
}
}
@media ( max-width: @max-width-tablet ) {
.mixin-collapse-toc-page-title();
.vector-below-page-title {
#vector-toc-collapsed-button,
.sidebar-toc {
position: fixed;
}
#vector-toc-collapsed-button {
top: 0;
left: 0;
margin: 0;
}
.sidebar-toc {
// TOC button height
top: 36px;
left: 6px;
}
}
}
@media ( min-width: @min-width-desktop ) {
@supports ( display: grid ) {
.client-js {
.vector-toc-collapsed .vector-layout-grid {
.mixin-collapse-toc-page-title();
.mw-table-of-contents-container {
grid-area: content;
}
.sidebar-toc {
left: -@icon-padding-md;
}
}
.vector-toc-collapsed {
.vector-toc-uncollapse-button {
display: inline-block;
}
}
body:not( .vector-toc-collapsed ) {
.vector-toc-collapse-button {
display: inline-block;
}
}
}
}
}