mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-26 00:25:40 +00:00
9e4bdd00bf
Rather than try to build individually build login, logout, and create account menu items, we handle them the same as all other user links menu items in Hooks.php. While Hooks isnt ideal, there currently isnt a good path for moving that code to SkinComponents until core provides menu data. In the meantime, this patch reduces code complexity and prevents bugs like T324638. This approach also allows us to move user links logic from SkinVector22 to VectorComponentUserLinks.php, and ensures the user links dropdown contains multiple menus, which allows us to reuse styles from page tools dropdowns. Expected 11 visual changes: * minor visual change where the user links dropdown has an additional 4px vertical padding. This padding was originally added to the page tools dropdowns per Alex's request, but Alex also said that dropdowns should share the same spacing. This change makes the styles all consistent * Order of talk and contribution links have been swapped Bug: T289212 Bug: T319356 Bug: T328954 Change-Id: Iac0586893fec26a8a6c2c904ce08fbf1e19b339c
190 lines
4.4 KiB
Plaintext
190 lines
4.4 KiB
Plaintext
@import '../../common/variables.less';
|
|
@import '../../common/mixins.less';
|
|
@import 'mediawiki.mixins.less';
|
|
@import 'mediawiki.ui/variables.less';
|
|
|
|
@font-size-user-links: unit( 14 / @font-size-browser, em ); // Equals `0.875em`.
|
|
// Applies to links in the overflow menu that do not have the .mw-ui-button class.
|
|
@overflow-link-margin: 0 8px;
|
|
|
|
/**
|
|
* Container that holds both the horizontal menu and dropdown menus.
|
|
*/
|
|
.vector-user-links {
|
|
display: flex;
|
|
align-items: center;
|
|
position: relative;
|
|
justify-content: flex-end;
|
|
flex-shrink: 1;
|
|
font-size: @font-size-user-links;
|
|
|
|
.mw-ui-button {
|
|
// FIXME: Overrides mw-ui-button's `display: inline-block` property so that
|
|
// the text in the button is vertically centered. `.mw-ui-button` sets a
|
|
// min-height to the button, but should also vertically center the
|
|
// button's children.
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.mw-list-item {
|
|
margin: 0;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Both logged-in and logged-out dropdown menus.
|
|
*/
|
|
.vector-user-menu {
|
|
.vector-menu-content {
|
|
left: auto;
|
|
right: 0;
|
|
|
|
.vector-feature-page-tools-disabled & {
|
|
min-width: 200px;
|
|
}
|
|
}
|
|
|
|
// Used to hide collapsible items inside the dropdown menu
|
|
// as well as the dropdown menu itself when the menu is empty
|
|
&.user-links-collapsible-item,
|
|
.user-links-collapsible-item {
|
|
@media ( min-width: @min-width-tablet ) {
|
|
display: none;
|
|
}
|
|
}
|
|
}
|
|
|
|
// FIXME: Remove selector after Iac0586893fec26a8a6c2c904ce08fbf1e19b339c has been in prod for a week
|
|
.vector-user-menu-logout,
|
|
.vector-user-menu-create-account,
|
|
.vector-user-menu-login,
|
|
.mw-portlet-personal .mw-list-item {
|
|
a {
|
|
.mixin-vector-dropdown-menu-item();
|
|
|
|
.vector-feature-page-tools-disabled & {
|
|
.mixin-vector-dropdown-menu-item-deprecated();
|
|
}
|
|
color: @color-link;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Horizontal links menu - logged in and logged out.
|
|
*/
|
|
.vector-user-links .mw-portlet-vector-user-menu-overflow {
|
|
.vector-menu-content-list {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
// TODO: Simplify button, icon button and link styling with T323244
|
|
@media ( min-width: @min-width-desktop ) {
|
|
// Right margin to separate overflow menu from dropdown
|
|
margin-right: 8px;
|
|
|
|
// Separate icon buttons inside the overflow menu
|
|
.vector-menu-content-list {
|
|
column-gap: 8px;
|
|
}
|
|
}
|
|
|
|
// Add margin to links that don't have the .mw-ui-button or related icon classes.
|
|
a:not( .mw-ui-button ):not( .mw-echo-notifications-badge ) {
|
|
margin: 0 8px;
|
|
}
|
|
|
|
.user-links-collapsible-item {
|
|
@media ( max-width: @max-width-mobile ) {
|
|
display: none;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Logged-in dropdown menu
|
|
*/
|
|
.vector-user-menu-logged-in {
|
|
.vector-menu-heading {
|
|
// override user menu (.mw-ui-icon) fixed width,
|
|
// so chevron beside icon is visible.
|
|
width: auto;
|
|
|
|
// and override again to ensure the user icon is 20px wide.
|
|
&:before {
|
|
width: auto;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Dropdown menu items- Special treatment for special links.
|
|
*/
|
|
#p-user-menu-anon-editor .vector-menu-heading {
|
|
display: block;
|
|
|
|
a:before {
|
|
content: '@{msg-parentheses-start}';
|
|
}
|
|
|
|
a:after {
|
|
content: '@{msg-parentheses-end}';
|
|
}
|
|
}
|
|
|
|
// Anon editor notice i.e. "Pages for logged out editors".
|
|
// FIXME: Remove selector after Iac0586893fec26a8a6c2c904ce08fbf1e19b339c has been in prod for a week
|
|
.vector-user-menu-anon-editor {
|
|
.mixin-vector-dropdown-menu-item();
|
|
|
|
.vector-feature-page-tools-disabled & {
|
|
.mixin-vector-dropdown-menu-item-deprecated();
|
|
}
|
|
|
|
.vector-feature-page-tools-enabled & p {
|
|
margin: 0;
|
|
}
|
|
color: @color-base--subtle;
|
|
|
|
a:before {
|
|
content: '@{msg-parentheses-start}';
|
|
}
|
|
|
|
a:after {
|
|
content: '@{msg-parentheses-end}';
|
|
}
|
|
}
|
|
|
|
// FIXME: Remove selector after Iac0586893fec26a8a6c2c904ce08fbf1e19b339c has been in prod for a week
|
|
// Login link.
|
|
.vector-user-menu-login {
|
|
border-bottom: @border-width-base @border-style-base @colorGray14;
|
|
}
|
|
|
|
// FIXME: Remove selector after Iac0586893fec26a8a6c2c904ce08fbf1e19b339c has been in prod for a week
|
|
// Logout link
|
|
.vector-user-menu-logout {
|
|
border-top: @border-width-base @border-style-base @colorGray14;
|
|
}
|
|
|
|
//User-page link in personal (overflow) menu.
|
|
#pt-userpage-2 {
|
|
max-width: unit( 155 / @font-size-browser / @font-size-user-links, em );
|
|
|
|
a {
|
|
// T312157 Override redlink (.new) color for non-existant userpage
|
|
color: @color-primary;
|
|
}
|
|
|
|
span {
|
|
.text-overflow( @visible: false );
|
|
}
|
|
|
|
// T287522#7295558: Increase the max-width of the username when viewport
|
|
// allows for it.
|
|
@media ( min-width: @min-width-desktop-wide ) {
|
|
max-width: unit( 200 / @font-size-browser / @font-size-user-links, em );
|
|
}
|
|
}
|