Debian Codegraph @

skins/Vector/resources/skins.vector.js/stickyHeader.less

raw
1 @spacing-search-title-divider: 30px;
2 @font-size-sticky-header-links: unit( 14 / @font-size-browser, em ); // Equals `0.875em`.
3 @import '../skins.vector.styles/variables.less';
4
5 .vector-sticky-header-container {
6 position: fixed;
7 top: 0;
8 left: 0;
9 right: 0;
10 z-index: @z-index-header;
11 // Hide sticky header until visible class is applied to the body
12 transition: @transition-sticky-header;
13 display: none;
14 transform: translateY( -100% );
15 opacity: 0;
16 }
17
18 .vector-sticky-header {
19 display: flex;
20 align-items: center;
21 justify-content: space-between;
22 border-bottom: @border-width-base @border-style-base @border-color-content-box;
23
24 //
25 // Layout
26 //
27 &-start,
28 &-end,
29 &-icons,
30 &-buttons,
31 &-context-bar {
32 display: flex;
33 align-items: center;
34 }
35
36 &-start {
37 flex-grow: 1;
38 min-width: 0;
39 }
40
41 // Apply nowrap to title and buttons
42 // Must apply to &-ccontext-bar-primary rather than &-context-bar or &-start
43 // to avoid applying nowrap to the collapsed TOC menu
44 &-context-bar-primary,
45 &-end {
46 white-space: nowrap;
47 }
48
49 //
50 // Components
51 //
52 &-context-bar {
53 border-left: @border-width-base @border-style-base #c8c8c8;
54 padding-left: @spacing-search-title-divider;
55 min-width: 0;
56 margin-left: @spacing-search-title-divider;
57 }
58
59 &-context-bar-primary {
60 overflow: hidden;
61 font-family: @font-family-serif;
62 // T296320 closest standardized option to 22px (24px)
63 font-size: @font-size-heading-2;
64 text-overflow: ellipsis;
65
66 // T300134 Prevent text from wrapping in the sticky header.
67 wbr {
68 display: none;
69 }
70 }
71
72 &-buttons {
73 // Reduce language and add topic button font size
74 font-size: @font-size-sticky-header-links;
75 }
76
77 // Spacing between buttons
78 &-icons,
79 &-buttons {
80 column-gap: 8px;
81 }
82
83 .vector-search-box {
84 // Hide the search box until the user toggles it.
85 display: none;
86 }
87
88 &.vector-header-search-toggled {
89 // .vector-sticky-header-search-toggle left border (1px) + left padding (12px)
90 // - .cdx-text-input__start-icon left offset (9px [1]) = 4px
91 // [1] see https://gerrit.wikimedia.org/r/plugins/gitiles/design/codex/+/refs/tags/v0.1.0-alpha.8/packages/codex/src/components/text-input/TextInput.vue#257
92 @margin-start-search-box: 4px;
93 // .vector-sticky-header-search-toggle left border (1px) + left padding (12px)
94 // - .cdx-text-input__start-icon left offset (22px [2]) = -9px
95 // [2] see https://gerrit.wikimedia.org/r/plugins/gitiles/design/codex/+/refs/tags/v0.1.0-alpha.8/packages/codex/src/components/typeahead-search/TypeaheadSearch.vue#708
96 @margin-start-search-box-with-thumbnail: -9px;
97
98 .vector-sticky-header-search-toggle,
99 .vector-sticky-header-context-bar {
100 display: none;
101 }
102
103 .vector-search-box {
104 display: block;
105 margin-left: @margin-start-search-box;
106 }
107
108 // T296318 Decrease the start margin of the search box to account for the
109 // icon's increased start position when the search component has thumbnails.
110 .vector-search-box-show-thumbnail {
111 margin-left: @margin-start-search-box-with-thumbnail;
112
113 .cdx-text-input__start-icon {
114 color: @color-base;
115 }
116 }
117 }
118 }
119
120 // T298836 Sticky header is only shown at higher resolutions
121 @media ( min-width: @min-width-breakpoint-desktop ) {
122 .client-js.vector-sticky-header-enabled {
123 // T290518: When the sticky header is enabled (feature flag is on, js is
124 // enabled, and viewport is at higher resolutions), add scroll padding to the
125 // root element. This is needed so that the sticky header does not overlap the
126 // top of an element when the URI has a hash fragment (e.g. when the user clicks
127 // a jump link) and when the user tabs through elements in reverse order.
128 //
129 // Please note that this class must be independent of the
130 // .vector-sticky-header-visible class to correctly handle situations where the
131 // sticky header isn't visible yet but we still need scroll padding applied
132 // (e.g. when the user navigates to a page with a hash fragment in the URI).
133 scroll-padding-top: ~'calc( @{height-header} + @{scroll-padding-top} )';
134
135 .vector-sticky-header-container {
136 // Sticky header is only enabled for js users and when feature flag is enabled
137 display: flex;
138 }
139
140 .vector-sticky-header-visible .vector-sticky-header-container {
141 // Show sticky header with transition when visible class is applied to the body
142 opacity: @opacity-base;
143 transform: translateY( 0 );
144 }
145
146 .vector-sticky-pinned-container {
147 top: ~'calc( @{height-header} + @{grid-row-gap} )';
148 max-height: ~'calc( 100vh - @{height-header} - (@{grid-row-gap} * 2) )';
149 }
150
151 // - T289817 `.mw-sticky-header-element` provides an API for template developers
152 // to make their templates compatible with the Vector 2022 sticky header.
153 // @stable See the Integration notes for developers section at
154 // https://www.mediawiki.org/wiki/Reading/Web/Desktop_Improvements/Features/Sticky_Header
155 // - `.charts-stickyhead th` makes chart and table headers appear below the sticky header.
156 // - Unlike the rule above targeting toc & page tools, this does not need extra padding
157 // for the context box, since these elements are inside the content container.
158 .mw-sticky-header-element,
159 .charts-stickyhead th {
160 /* stylelint-disable-next-line declaration-no-important */
161 top: @height-header !important;
162 }
163 }
164 }