Update user links storybook

- Fixes logged in and logged out links in the user links storybook
- Fixes type def warnings by importing defs
- Update the user page styles in storybook

Bug: T284584
Change-Id: I8e56df16617f71be89ac8d3094497cdb0daa64ef
This commit is contained in:
bwang 2021-06-21 14:30:11 -05:00 committed by Jdlrobson
parent b4e1929d84
commit 7909cf1eb6
4 changed files with 23 additions and 5 deletions

View file

@ -33,3 +33,9 @@
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAx0lEQVQ4jdXSzQmEQAwFYEuYUixhSwgkA8mQgKXYgS3YgXZgCZagHWgHuxf14t8osssGcv145CVJvjk+hBRFK2TrkK1D0cqHkN7CUBRI7L21KAqXMIDModiwD9oAkLlH0i3L+ooGiTWPAPPfJQTIHLGOB9h46YZnKS+3PI8PISW2GkV7FO2Jrb79h4+ODyElsYJYm437NSRWRCWdylgj++U0u+UAZI5E22hsWW03UWQtr2NT66zlCjz8uzNQbFiDN7F5/xB8aj57Ynp2FKI0bAAAAABJRU5ErkJggg==") !important;
background-repeat: no-repeat;
}
// Override user page icon styles for new user links
.vector-user-links #pt-userpage a {
background: none !important;
padding-left: 0;
}

View file

@ -1,3 +1,6 @@
/**
* @external MenuDefinition
*/
import menuTemplate from '!!raw-loader!../includes/templates/Menu.mustache';
import { helperMakeMenuData } from './utils';

View file

@ -1,5 +1,6 @@
/**
* @external MenuDefinition
* @external UserLinksDefinition
*/
import { menuTemplate } from './Menu.stories.data';
import userLinksTemplateLegacy from '!!raw-loader!../includes/templates/legacy/UserLinks.mustache';
@ -51,17 +52,21 @@ const PERSONAL_MENU_TEMPLATE_DATA = {
const additionalMenuData = {
class: 'vector-user-menu vector-menu-dropdown',
'is-dropdown': true,
'msg-vector-anon-user-menu-pages': `Pages for logged out editors`,
'heading-class': 'mw-ui-icon mw-ui-icon-element'
};
const loggedInData = {
'is-anon': true
'is-anon': true,
'html-after-portal': `
<div id="pt-logout" class="vector-user-menu-login">
<a data-mw="interface" href="/w/index.php?title=Special:UserLogout&amp;returnto=Main+Page" class="vector-menu-content-item">Log out</a>
</div>
`
};
const loggedOutData = {
'is-anon': true,
'html-before-portlet': `
'html-before-portal': `
<div class="vector-user-menu-login">
<a href="/w/index.php?title=Special:UserLogin&amp;returnto=Main+Page" class="vector-menu-content-item" title="You are encouraged to log in; however, it is not mandatory [ctrl-option-o]" accesskey="o">Log in</a>
</div>
@ -80,7 +85,7 @@ const USER_LINKS_LOGGED_IN_TEMPLATE_DATA = {
'is-anon': false,
'data-user-page': helperMakeMenuData( 'user-page', USERNAME_ITEM ),
'data-notifications': helperMakeMenuData( 'notifications', ECHO_ITEMS ),
'data-user-menu': helperMakeMenuData( 'new-personal', REST_ITEMS, Object.assign( additionalMenuData, loggedInData ) )
'data-user-menu': helperMakeMenuData( 'new-personal', REST_ITEMS, Object.assign( {}, additionalMenuData, loggedInData ) )
};
/**
@ -89,7 +94,7 @@ const USER_LINKS_LOGGED_IN_TEMPLATE_DATA = {
const USER_LINKS_LOGGED_OUT_TEMPLATE_DATA = {
'is-anon': true,
'html-create-account': `<a href="/w/index.php?title=Special:CreateAccount&amp;returnto=Main+Page" class="mw-ui-button mw-ui-quiet" title="You are encouraged to create an account and log in; however, it is not mandatory">Create account</a>`,
'data-user-menu': helperMakeMenuData( 'new-personal', REST_ITEMS, Object.assign( additionalMenuData, loggedOutData ) )
'data-user-menu': helperMakeMenuData( 'new-personal', REST_ITEMS, Object.assign( {}, additionalMenuData, loggedOutData ) )
};
export {

View file

@ -1,3 +1,7 @@
/**
* @external MenuDefinition
*/
/**
* @param {string} msg
* @param {number} [height=200]