edb4385345
A list that toggles visibility via the checkbox hack is needed in at least two spots: the page actions overflow menu and the user menu. This patch makes several refactors to turn what was previously hardcoded into page actions a reusable component: - Start a new components directory. Components are reusable and composable. The subdirectories are organized by function, not ResourceLoader module bundling which greatly improves the ability to see a component's full functionality in one directory instead of examining the entire codebase. See updates to README. - Extract pageactions.less into: - ToggleList.less: LESS for any checkbox hack list. - DropDownList.less: LESS for lists that open downwards. - MenuListItem.less: LESS for list items of menus. The division makes it easier to see concerns, dependencies, and change code. - Move pageActionMenu.mustache to a component and extract ToggleList template. - Extract ToggleList.js from Toolbar.js. Bug: T214540 Change-Id: I171831469a6733c458bc5c7ba249a5096ca975b8
135 lines
3.1 KiB
Plaintext
135 lines
3.1 KiB
Plaintext
@import '../../minerva.less/minerva.variables';
|
|
@import '../../minerva.less/minerva.mixins';
|
|
|
|
.heading-holder {
|
|
padding: @titleSectionSpacingTop 0 0;
|
|
position: relative;
|
|
|
|
.tagline {
|
|
color: @colorGray5;
|
|
font-size: @taglineFontSize;
|
|
}
|
|
}
|
|
|
|
.page-heading {
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
// used to disable the languages icon.
|
|
.mw-ui-icon-element.disabled {
|
|
cursor: default;
|
|
opacity: 0.25;
|
|
}
|
|
|
|
#page-actions {
|
|
position: relative;
|
|
}
|
|
|
|
.page-actions-menu {
|
|
.box-sizing( border-box );
|
|
border-top: 1px solid @colorGray14;
|
|
border-bottom: 1px solid @colorGray12;
|
|
}
|
|
|
|
.page-actions-menu__list {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
height: @pageActionToolbarHeight;
|
|
}
|
|
|
|
.page-actions-menu__list-item {
|
|
display: flex;
|
|
flex-basis: 4em;
|
|
justify-content: flex-end;
|
|
align-items: center;
|
|
|
|
// overriding default icon styles
|
|
.mw-ui-icon-element {
|
|
// The page actions menu icons are ever so slightly larger
|
|
// than standard icons.
|
|
@pageActionsIconSize: @iconSize + 0.15;
|
|
// explicitly added to ensure this element (which is an anchor) receives width/height
|
|
// when it's viewed in services that manipulate DOM such as Google Translate.
|
|
display: block;
|
|
position: relative;
|
|
min-width: @pageActionsIconSize;
|
|
width: @pageActionsIconSize;
|
|
height: @pageActionsIconSize;
|
|
|
|
&:hover {
|
|
box-shadow: none;
|
|
}
|
|
|
|
&:before {
|
|
margin: 0;
|
|
// `.mw-ui-icon` absolutely positions this pseudo-element but only
|
|
// positions right & left. This ensures icon stretches 100% height and
|
|
// stretches the entire height of its parent element.
|
|
top: 0;
|
|
bottom: 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
.minerva--amc-enabled .page-actions-menu__list-item {
|
|
flex-basis: auto;
|
|
}
|
|
|
|
// Layout for less than 5 items - one item at the beginning, rest at the end.
|
|
// |1-----2--3--4|
|
|
.page-actions-menu__list-item:first-child {
|
|
flex-grow: 1;
|
|
justify-content: flex-start;
|
|
}
|
|
|
|
// When AMC is enabled, space all items equally.
|
|
.minerva--amc-enabled .page-actions-menu__list-item:first-child {
|
|
flex-grow: 0;
|
|
}
|
|
|
|
.page-actions-overflow-list {
|
|
// The top of the menu is flush with the bottom of the page actions toolbar.
|
|
top: 100%;
|
|
right: 0;
|
|
//
|
|
// A variable max-height is set in JavaScript so a minimum height is needed.
|
|
min-height: 200px;
|
|
}
|
|
|
|
// overriding common.less `display:inherit` (which causes `display: flex;` in this instance).
|
|
.client-js .jsonly#ca-watch {
|
|
display: list-item;
|
|
}
|
|
|
|
// Watchstar is hidden for anonymous no-js users
|
|
// While we could link the icon to the login/signup form, this is not
|
|
// a perfect experience and could be confusing.
|
|
// In JavaScript this icon will be converted to a watch icon and will point
|
|
// to a Call to action to sign up/login and explain why that's a good idea.
|
|
// Thus, anonymous users without JS will never see this icon.
|
|
// This is a small % of our users, so deemed okay.
|
|
.client-nojs {
|
|
.watch-this-article {
|
|
visibility: hidden;
|
|
}
|
|
|
|
.is-authenticated {
|
|
.watch-this-article {
|
|
visibility: visible;
|
|
}
|
|
}
|
|
}
|
|
|
|
// On small devices that don't support Javascript, hide the page actions bar
|
|
@media all and ( max-width: @width-breakpoint-mobile - 1 ) {
|
|
.client-nojs {
|
|
#page-actions {
|
|
display: none;
|
|
}
|
|
|
|
#section_0 {
|
|
border: 0;
|
|
}
|
|
}
|
|
}
|