mediawiki-skins-Vector/stories/Sidebar.stories.data.js
jdlrobson 703903daac [legacy] Split sidebar code and mark layout as legacy in preparation for new layout
Going into the new version of Vector, we'll want to rewrite the layout
rules entirely and decouple the sidebar from the logo.

To prepare for this we will move the layout file into a legacy folder.
We also separate Sidebar styles needed for the legacy mode from the old mode.

This will allow us to make changes to the header in new Vector without having to touch
or test the legacy codebase via a new file layout.less and using the existing sidebar
code.

Bug: T246170
Change-Id: Ieb4f8f2b2f0e4f48d76a210ab30acd08e3e83bcb
2020-04-16 11:29:03 -07:00

66 lines
1.6 KiB
JavaScript

import sidebarTemplate from '!!raw-loader!../includes/templates/Sidebar.mustache';
import portalTemplate from '!!raw-loader!../includes/templates/Portal.mustache';
import { PORTALS } from './Portal.stories.data';
const HTML_LOGO_ATTRIBUTES = `class="mw-wiki-logo" href="/wiki/Main_Page" title="Visit the main page"`;
const SIDEBAR_BEFORE_OUTPUT_HOOKINFO = `Beware: Portals can be added, removed or reordered using
SidebarBeforeOutput hook as in this example.`;
export { sidebarTemplate };
export const SIDEBAR_TEMPLATE_PARTIALS = {
Portal: portalTemplate
};
export const SIDEBAR_DATA = {
withNoPortals: {
'has-logo': true,
'array-portals-rest': [],
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
},
withPortalsAndOptOut: {
'has-logo': true,
'array-portals-first': PORTALS.navigation,
'data-emphasized-sidebar-action': {
href: '#',
text: 'Switch to old look'
},
'array-portals-rest': [
PORTALS.toolbox,
PORTALS.otherProjects,
PORTALS.langlinks
],
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
},
withPortals: {
'has-logo': true,
'array-portals-first': PORTALS.navigation,
'array-portals-rest': [
PORTALS.toolbox,
PORTALS.otherProjects,
PORTALS.langlinks
],
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
},
withoutLogo: {
'has-logo': false,
'array-portals-first': PORTALS.navigation,
'array-portals-rest': [
PORTALS.toolbox,
PORTALS.otherProjects,
PORTALS.langlinks
]
},
thirdParty: {
'has-logo': true,
'array-portals-rest': [
PORTALS.toolbox,
PORTALS.navigation,
{
'html-portal-content': SIDEBAR_BEFORE_OUTPUT_HOOKINFO
}
],
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
}
};