mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-28 17:40:12 +00:00
93745e4800
Per T289724#7342741, server renders an anchor tag pointing to #p-search into the "button-start" bucket of the sticky header. In the future after T289718, this anchor will then acts as a button when the search module is loaded and searchToggle executes. * skins.vector.search was modified to accomodate instantiating multiple search components (one in the main header and one in the sticky header). * searchToggle.js was modified to accept a searchToggle element as a param which the caller can then instantiate when ideal. For the sticky header toggle, this needs to happen *after* the search module loads. Before then, the toggle will act as a link. * Drops one jQuery usage from searchToggle so that it can be jQuery free. Because the native .closest method is used, IE11 support is also dropped. However, the script feature detects and returns early if the API isn't available. * Makes App.vue accept an `id` prop so that multiple instances of it can be created. Bug: T289724 Change-Id: I1c5e6eee75918a0d06562d07c31fdcbd5a4ed6d5
42 lines
914 B
JavaScript
42 lines
914 B
JavaScript
import template from '!!raw-loader!../includes/templates/StickyHeader.mustache';
|
|
import Button from '!!raw-loader!../includes/templates/Button.mustache';
|
|
|
|
const NO_ICON = {
|
|
icon: 'none',
|
|
'is-quiet': true,
|
|
class: 'sticky-header-icon'
|
|
};
|
|
|
|
const data = {
|
|
title: 'Audre Lorde',
|
|
heading: 'Introduction',
|
|
'is-visible': true,
|
|
'data-primary-action': {
|
|
id: 'p-lang-btn-sticky-header',
|
|
class: 'mw-interlanguage-selector',
|
|
'is-quiet': true,
|
|
label: '196 languages',
|
|
'html-vector-button-icon': `<span class="mw-ui-icon mw-ui-icon-wikimedia-language"></span>`
|
|
},
|
|
'data-search': {
|
|
class: ''
|
|
},
|
|
'data-button-start': {
|
|
icon: 'wikimedia-search',
|
|
href: '#',
|
|
class: 'search-toggle',
|
|
'is-quiet': true,
|
|
label: 'Search'
|
|
},
|
|
'data-button-end': NO_ICON,
|
|
'data-buttons': [
|
|
NO_ICON, NO_ICON, NO_ICON, NO_ICON
|
|
]
|
|
};
|
|
|
|
export const STICKY_HEADER_TEMPLATE_PARTIALS = {
|
|
Button
|
|
};
|
|
|
|
export { template, data };
|