/
layout-default.less
318 lines (278 loc) · 8.97 KB
/
layout-default.less
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
//
// Default layout for Modern Vector.
//
body {
background-color: @background-color-secondary--modern;
color: @color-base;
// Vertical scrollbar always visible.
overflow-y: scroll;
}
.mw-body,
.parsoid-body {
direction: ltr;
padding: @padding-content;
}
.mw-body {
border-top: @border-width-base @border-style-base @border-color-content;
/* Merge the border with tabs' one (in their background image) */
margin-top: -@border-width-base;
padding: @padding-content;
.firstHeading {
/* Change the default from mediawiki.skinning CSS to let indicators float into heading area */
overflow: visible;
}
}
.mw-header {
// A min-height is set to account for projects where no icon is set.
min-height: @height-logo-icon;
margin: @margin-top-header 0 @margin-bottom-header;
padding: @padding-vertical-header 0;
// Vertical centering of header elements (IE>=11), requires flex.
// Non-flex fallback for IE<=9: float rule on the child elements.
.flex-display();
flex-wrap: wrap;
// https://caniuse.com/#search=align-items
align-items: center;
// allow z-index to apply so search results overlay article
position: relative;
z-index: @z-index-header;
}
/* Searchbox */
#p-search {
float: left;
margin: 0 0 0 @margin-horizontal-search;
flex-grow: 1;
flex-basis: @min-width-search;
// #searchform is only a direct child of #p-search before wvui-loads. After
// wvui loads, `.wvui-typeahead-search` becomes the direct child and is the
// element where these styles should apply.
> #searchform,
.wvui-typeahead-search {
// Border-box sizing is used for a smooth transition from legacy to Vue
// search. The width of the container should stay the same before/after the
// transition.
.box-sizing( border-box );
margin-left: 0;
max-width: @max-width-search;
}
}
/* Main column */
.mw-body,
#mw-data-after-content,
#left-navigation,
.mw-footer {
margin-left: 0;
}
/* Content */
.mw-indicators {
float: right;
z-index: @z-index-indicators;
}
.mw-body-content {
position: relative;
z-index: @z-index-base;
}
/* Hide, but keep accessible for screen-readers */
#mw-navigation h2 {
position: absolute;
top: -9999px;
}
/* Navigation Containers */
.mw-article-toolbar-container {
// Clear the floats on #left-navigation and #right-navigation.
.mixin-clearfix();
// We want to keep the max-width of the article-toolbar-container the
// same max-width as the article page's content container in order to
// prevent it from moving when going from an article page to a
// history/special page.
max-width: @max-width-content-container;
margin-left: auto;
margin-right: auto;
}
#left-navigation {
float: left;
}
#right-navigation {
float: right;
}
#p-personal {
flex-grow: 1;
flex-basis: @min-width-personal-tools;
margin-left: @margin-horizontal-search;
// Support IE9: This is reset in @support query below if Flexbox is available.
float: right;
}
#mw-sidebar-button {
float: left; // Browser: IE9 support - button as flex-child fallback.
margin-left: -@margin-horizontal-sidebar-button-icon;
margin-right: @margin-horizontal-sidebar-button-icon; // Accidentally the same.
}
#mw-panel {
background-image: linear-gradient( to bottom, @background-color-base 0%, @background-color-secondary--modern 10%, @background-color-secondary--modern 90%, @background-color-base 100% );
position: absolute;
// Sidebar is displaced from the workspace container so that the
// sidebar is flush with the edge of the screen at small widths.
left: -@padding-horizontal-page-container;
width: @width-grid-column-one;
.box-sizing( border-box );
// To avoid the white part of the gradient colliding with the sidebar links
// we apply top and bottom padding.
padding: 8px 0 40px @padding-left-sidebar;
z-index: @z-index-sidebar;
}
.parsoid-body {
padding: @padding-content;
}
#p-namespaces {
background-image: none;
padding-left: 0;
}
.mw-footer {
border-top: @border-base;
padding: 32px 0 0 0;
}
// Container logic.
.mw-page-container {
// Set a min-width to make explicit we do not support anything below this threshold.
// For devices too small, they should be more useable with horizontal scrolling.
// e.g. Portrait on an iPad
min-width: @min-width-supported;
max-width: @max-width-page-container;
// Fill the viewport even if the content height is small. This also helps
// mitigate a long sidebar overflowing the page container (T257518).
min-height: 100%;
margin-left: auto;
margin-right: auto;
// Use non-zero padding to disable margin collapse.
// Be careful not to use overflow-y: scroll here (see T270146 and T271868)
padding: 0.05px ( @padding-horizontal-page-container / 2 );
background-color: @background-color-page-container;
}
// Used as a container for absolutely positioned elements.
.mw-page-container-inner {
position: relative;
}
.mw-workspace-container {
max-width: @max-width-workspace-container;
margin-left: auto;
margin-right: auto;
// The sidebar is absolutely positioned relative to the
// mw-workspace-container.
position: relative;
&.mw-footer-container {
// T264679: There are elements (e.g. discussion tool popovers) in the main
// content container that we want to appear on top of the footer. We set the
// footer container to have static positioning instead of relative
// positioning (applied by .mw-workspace-container) to enable this.
position: static;
}
}
.mw-content-container {
max-width: @max-width-content-container;
margin-left: auto;
margin-right: auto;
// For container logic specific to special pages and history pages.
.action-history &,
.ns-special & {
// Allow the max-width of content on history/special pages to be wider than
// the max-width of content on article pages.
max-width: none;
}
}
.mw-sidebar-container {
position: absolute;
top: 0;
left: 0;
right: 0;
}
.mw-footer-container {
padding-top: 50px;
padding-bottom: 82px;
}
// We want it to appear like the sidebar is going into/coming out of
// `.mw-page-container`, but we can't use `overflow: hidden` on
// `.mw-page-container` because that will cut off the sidebar. Therefore, we
// calculate the maximum distance from the start of `mw-page-container` to the
// start of the sidebar.
#mw-sidebar-checkbox:not( :checked ) ~ .mw-workspace-container .mw-sidebar {
.transform( translateX( -( @max-width-page-container - @max-width-workspace-container ) / 2 ) );
}
// Responsive overrides.
@media ( min-width: @min-width-page-container--padded ) {
.mw-page-container {
border-left: 1px solid @border-color-sidebar;
border-right: 1px solid @border-color-sidebar;
}
}
// Adjusts the content when sidebar is open regardless of the viewport width.
.mw-checkbox-hack-checkbox:checked ~ .mw-workspace-container .mw-content-container {
// For container logic specific to special pages and history pages.
.action-history &,
.ns-special & {
margin-left: @margin-start-content;
}
}
@media ( max-width: @max-width-margin-start-content ) {
#p-search {
// Support: IE 8, Firefox 18-, Chrome 19-, Safari 5.1-, Opera 19-, Android 4.4.4-.
width: 13.2em;
// Support: Modern browsers, responsive width.
width: 20vw;
max-width: 100%;
}
// Adjusts the content and mw-article-toolbar-container.
.mw-checkbox-hack-checkbox:checked ~ .mw-workspace-container .mw-content-container,
.mw-checkbox-hack-checkbox:checked ~ .mw-workspace-container .mw-article-toolbar-container {
margin-left: @margin-start-content;
}
// Specificity needed to disable the default animations at lower resolutions.
.vector-animations-ready .mw-sidebar {
// Remove sidebar transition at smaller widths.
.transition( none );
}
}
@media ( min-width: ( @max-width-workspace-container + ( 2 * @padding-horizontal-page-container ) ) ) {
#mw-panel {
background: @background-color-page-container;
border-right: 1px solid @border-color-sidebar;
}
}
// At low resolutions the search must be pushed to the right of the screen
// We use @width-comfortable to determine this threshold as we know it's not possible for
// personal tools to be on the same line at this resolution.
@media ( max-width: @width-comfortable ) {
// #searchform is only a direct child of #p-search before wvui-loads. After
// wvui loads, `.wvui-typeahead-search` becomes the direct child and is the
// element where these styles should apply.
#p-search > #searchform,
#p-search .wvui-typeahead-search {
margin-left: auto;
}
}
@media ( min-width: @width-breakpoint-tablet ) {
#p-search {
min-width: @min-width-search-tablet;
}
.mw-page-container {
padding: 0 @padding-horizontal-page-container;
}
}
/**
* Makes the sidebar full screen at lower resolutions.
*/
@media ( max-width: @width-breakpoint-tablet ) {
.mw-checkbox-hack-checkbox:checked ~ .mw-workspace-container {
#mw-panel {
width: 100%;
position: relative;
left: 0;
}
// !important as we always want to disable the margin-left on these elements
// Using !important is cleaner than having to rely on specificity involved :checked elements
.mw-content-container,
.mw-article-toolbar-container {
// stylelint-disable-next-line declaration-no-important
margin-left: 0 !important;
}
}
}