Commit Graph

90 Commits

Author SHA1 Message Date
jenkins-bot dce2ea9566 Merge "Update Abkhaz language name" 2022-01-04 17:01:02 +00:00
Amir E. Aharoni b064c131d6 Update Abkhaz language name
Bug: T298309
Change-Id: I735da5e1ce214fa41d4401274daa3ad361987344
2021-12-25 14:08:46 +02:00
jdlrobson 44aeee5d83 Vector uses html-title-heading
The H1 is available with the correct attributes in core now, so
we can use that instead of our own markup. This also means Vector
will benefit from updates to the heading in core such as main page
special handling.

Bug: T297728
Change-Id: I4d10370678fad6455d73994bf340891760543b71
2021-12-15 22:27:48 +00:00
bwang 3981333271 Update sandbox user menu icon
Bug: T288928
Change-Id: I9b781ade0cdc1114dc1cb2aa087fb49bf8aa4acd
2021-11-23 11:21:45 -06:00
Ed Sanders 90b5ff5149 Define documentable types in eslintrc instead of inline
Change-Id: I80f0557a6355208d2694f3776cce2ee858573a9c
2021-10-18 18:08:32 +00:00
jdlrobson 125ea5dea9 Wire up sticky header search feature
Bug: T289724
Change-Id: I784ea5eb12b6f43d19769ff48a14d3fd4627853c
2021-09-27 14:47:58 -07:00
jdlrobson caed16e26f Allow multiple search components on the same page
Styling should not depend on IDs to allow us to have multiple
searches in the page.

Precursor for wiring up search in the sticky header.

This also tweaks performance metrics to track separate metrics
for the sticky header search

Change-Id: I5b4192a8f5a9f95af26c1faf904f7cc994323518
2021-09-23 23:23:58 +00:00
Nicholas Ray 93745e4800 Add search to sticky header
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
2021-09-14 16:58:07 -07:00
jdlrobson ad5c127239 [Storybook] Add Header component
* Moves screen variables relating to Header to Header
* Adds a Header storybook entry
* Moves data-logo from Logo template to Header.mustache
* Updates UserLinks to use USER_LINK_PARTIALS
* Renames confusing SearchBox story names
* Updates package.json to use a static folder.
* Use mediawiki.org for sourcing mw-ui-button and mw-ui-icon styles
since deploys there come earlier
* Removes usages of ID selectors

Change-Id: I0e158fa7e62c56a50cfff497d75f0808effd1eed
2021-09-14 18:33:10 +00:00
jdlrobson 31dba307ed [refactor] SearchBox uses Icon template partial
Change-Id: I8ff49b85dd2151618e48251e0fc38152a50ca381
2021-09-09 18:57:37 +00:00
jdlrobson 0be41f3414 [storybook] ButtonAndIcons should use Button template
Change-Id: I391cd6b3f9d167c1ff659bba6a5e12be7ff9a439
2021-09-08 19:32:31 +00:00
bwang 62149265e9 Add ULS to sticky header
- Rework Icon template into Button template to support all button variants
- Update ULS helper functions in SkinVector
- Update StickyHeader template to use the new Button template
- Update Storybook

Bug: T289815
Depends-on: Iba6cbbd6c6e48a1abfda342421822e3ff2715362
Change-Id: I718b3e05a988e20beb82d599e4168d497fa4c299
2021-09-08 12:39:55 -05:00
jdlrobson 3ed167f318 [storybook] Document button usage and update broken stories
* add stories for buttons and icons using wvui and mwui
* Update user link stories
* Add the vector-menu-dropdown-noicon class to more and
variants menu
* Fixes the language button story and simplifies its code.
* Updates Hooks::makeButtonIcon to Hooks::makeIcon which
reflects the method purpose more. It doesn't output button
classes.

Bug: T289514
Change-Id: Ifd750da0c0181ec56f39ff00d653e88bfc848038
2021-09-07 21:23:33 +00:00
jdlrobson 8657171471 Build the sticky header skeleton
The sticky header is currently disabled unconditionally
and nothing is wired up, with placeholders for data and
functionality which will be added in future.

Bug: T289716
Change-Id: I16223ce849267e718aad22b8a24b2327332ac8b7
2021-09-01 12:32:31 -07:00
jenkins-bot fef51f9023 Merge "Improve readability of anon user menu for screenreaders" 2021-08-27 20:36:16 +00:00
bwang d15005408f Improve readability of anon user menu for screenreaders
Bug: T288293
Change-Id: I10ca58aa492447f179c0ce12eabc0cd1ce4e9d9b
2021-08-26 12:58:10 -05:00
Clare Ming 1efe0a4203 Remove user links feature flag
Update/remove config, constants, hooks, templates, styles, logic, tests, stories to check legacy vs modern Vector where applicable instead of the decommissioned user links feature flag.

Bug: T288852
Change-Id: I5c5831091a10711838a8a2877c782df4996d4596
2021-08-26 10:07:15 -06:00
Clare Ming 129bf5c350 Update vector menu hide dropdown class to use BEMish convention.
- Keep double-dash class name for cached HTML.
- Update instances of renamed class in less + js.

Bug: T253671
Change-Id: Ieb1ce630e8fa84167e2ca8497f66a20183fdaf90
2021-08-24 15:33:41 +00:00
bwang d1f1f32418 Update UserLinks and SearchBox storybook stories to match prod
- Update UserLinks data to wrap link content with spans and other markup changes
- Use UserLinks__login.mustache and UserLinks__logout.mustache for rendering UserLink stories
- Add new SearchBox story to account for search collapse behavior in modern Vector

Change-Id: Ib0abce31db60a0c5c88dea17085e2974ac5112b5
2021-08-05 10:08:31 -05:00
jdlrobson 276738b620 Consolidate user links outside of the user menu dropdown into a single new menu
- Adds UserLinks__more template to process the list of user links.
- Simplifies styles in UserLinks.less, and namespace them under .vector-user-menu-more
- Add i18n for the label of the new navigation menu
- Update storybook and typing

Bug: T284584
Change-Id: I92290815869dcb939f01d9aff4aa202f6f004894
2021-07-15 20:27:54 +00:00
bwang 0a75e2e627 Ensure userAvatar icon is only used in logged in users
Additional change: A bundlesize increase is required given
recent developments in the user menu.

Bug: T284748
Change-Id: I2b0981d621c3add42731e50d5aef299b32548b4a
2021-06-30 22:41:47 +00:00
jdlrobson 6777c5b1fe Collapse header at lower resolutions
Reduces the min-width to 340px with several changes at lower
resolutions
* collapses create account into dropdown
* hides language button and user messages
* The search component is updated to include a search toggle which
can be used to hide and show the search input at lower resolutions
- this leads to a slight HTML change with caching implications,
it also moves away from a BEM usage which is not standard for this
repository.
* limits width of logo based on the dimensions we display
in mobile

Bug: T276566
Change-Id: I89d75843ca7e33e6de93af5d7c22e46b7249c4b7
2021-06-30 21:43:35 +00:00
bwang d8351bc0ae Update user links storybook
- Remove logged in links from logged out user links storybook
- Add icons to all user links

Bug: T284584
Change-Id: I7fbe22b257d1a6e08c27315d69b0ae1233868aed
2021-06-22 18:52:26 +00:00
bwang 84737bc9c7 Remove reference to BaseTemplateAfterPortlet
Bug: T280608
Change-Id: I87ebd765defd7c71f2463257d8bae14107988220
2021-06-22 15:02:01 +00:00
bwang 7909cf1eb6 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
2021-06-21 21:34:35 +00:00
bwang 8389de9cb9 Update user menu icon and storybook
Bug: T284748
Change-Id: Icdbfd882490b380871befd3c6606c4b48d225132
2021-06-18 20:30:55 +00:00
bwang 0fc7be61c1 Update tests for default Menu template value
Change-Id: I32586a379cbacaad5cfb361facf79c01e982818a
2021-06-15 17:02:53 -05:00
bwang 34344adbf5 Remove UserMenu and use Menu template instead
- Adds html-before-portlet to Menu.mustache
- Removes UserMenu.mustache and type def
- Factors out getCreateAccountHTML and getLoginHTML for generating HTML used in Menu
- Scopes UserLink template data under "data-vector-user-links"

Follow up to: 298f945983
Bug: T284584
Change-Id: I91104eb7c4fd12756e770561666f4c9a64da57d6
2021-06-11 09:41:58 -05:00
bwang b4c0e8e67d Storybook: Add stories for logged in and logged out UserLinks
- Update menu helper params to support additional data
- Add UserLinks typing

Follow up to: 298f945983
Change-Id: I0f9d1ac3289101566f437213714b872f6fa9199b
2021-06-03 21:42:28 +00:00
bwang 298f945983 Create new user menu template for consolidated user links in logged out users
- Adds mustache template for the new user menu
- Uses new functions for getting user link data that have been factored out of SkinTemplate in the dependent patch
- Refactor new user menu styles to be namespaced inside UserMenu.less

Notes:
- Originally this patch included more storybook changes, but I removed them in favor of this follow up patch: 696651

Bug: T276564
Depends-On: Ia841f92c626ca32a9ad437b3d1cff78309c83ed8
Change-Id: Ib15752428265fdc06a3000f62bdca44c67648974
2021-06-02 09:23:22 -05:00
jdlrobson 6300923601 Storybook should include UserLinks
Merge UserMenu into UserLinks for legacy and modern
Add a story for the UserLinks menu

Fixes: rendering of Skin (legacy) personal tools (the user icon
no longer overlaps)

Change-Id: I491ebb3962780bf2cf7f1dfb4dd09d576c294366
2021-05-27 19:27:27 +00:00
jdlrobson e1d0f1e61c Storybook: Consistent styling
- Make sure common styles are loaded for all components
- Add icon in user menu

Fixes renders of:
- Language button (no top margin and button styles)
- MenuPortal (no left margins)


Change-Id: I98b4820b6d91d46fd27a1d433d5bacd187a7cbb0
2021-05-27 19:27:21 +00:00
jdlrobson e305d720d4 Storybook: Move helperMakeMenuData into utils
In preparation for using for the UserLinks component.

Change-Id: Ifd3d1cc5513cd1477d1cb2e5d6e4db800fee12f7
2021-05-27 18:06:05 +00:00
Jan Drewniak c22dc8d95b Refactor: Renaming mustache variable `page-isarticle` to `is-article`
Modifies this variable name to use proper hyphen-case and
prioritizes the type of variable rather than it's source.

This prioritization makes sense in Mustache templates because the
variable is a boolean and is used exclusively in if statements,
e.g. {{#is-article}} ... {{/is-article}}

Change-Id: I72e9baf0a979d922b8217aabe8cf0c40699f891b
2021-05-10 08:55:06 +00:00
Jdlrobson d2c7805fa8 LanguageButton story should load mediawiki ui button styles
Discovered while testing I97bf0c11d0321752d472ac4988618a1db92b7271

Change-Id: I8634717ea58544b2d226fbb114bea43639a6542d
2021-05-05 09:41:10 -07:00
jdlrobson 8d8e2d85e6 Language button is quiet with focus, active and hover states
* Add mediawiki ui button styles to Vector and convert language
button to a quiet button
* Restore the arrow for language button with ULS
* Vertically align button to first line of header
* Add a storybook entry for LanguageButton

Additional changes:
* Fix issues revealed by storybook - menu dropdown should
reset generic typography rule for `ul` tags
* Allow quotes usage in storybook without disable rule

Bug: T268241
Change-Id: I483350084fb46a51c50af6aab78c62db6d02df89
2021-03-01 20:01:45 +00:00
jdlrobson 9f1a1fa829 Simplify menu code
SkinMustache in core provides most of what is required for Vector to
generate its menus.  In the interest of having a canonical source of
truth for menus across all skins, Vector should use this data.

To ensure the HTML generated is (mostly) the same after this patch to
prior, a few modifications are necessary:

* The data from core is decorated so that Vector can continue having its
  own custom class names on menus. This is done using the
  decoratePortletClass method.
* There is no support for a menu having a header representing the
  selected menu item, as is currently the case with variants. This is
  achieved via an extension to getPortletData. It's assumed that later
  when variants are merged with languages, this can be removed.
* Menus are agnostic to how they are displayed, so we must continue to
  add the is-dropdown template variable to drop down menus. In future we
  may want to rethink our Menu partial to make this unnecessary in PHP.
* The portal-first class is redundant in the modern Vector as we can
  use the first-child selector. Previously we introduced a class to
  service the legacy skin where this rule doesn't apply as #p-logo is
  the first child.  However, the legacy skin can do this using a special
  next sibling selector instead.

Bug: T268157
Change-Id: I5f7adc1840441b508ffee40139b85b64021789e6
2021-01-04 19:02:34 +00:00
jdlrobson 227534102a Separate opt out data from sidebar
In preparation for using the data provided by SkinMustache class
we need to separate the opt out data from the rest of the sidebar.
The opt out data is specific to Vector.

Change-Id: I4461da92c1787d272bbf99e6644bdb9e6c388a68
2020-11-05 22:08:00 +00:00
jdlrobson edb8872c95 Fix storybook instance display of footer and personal menu
* The classes provided on the personal menu are incorrect. Rectify these
by creating a menu helper
* Register the footer template partials

Change-Id: I4b73be54c073f0dd350c107b18f10456c9ee1b17
2020-10-08 16:08:43 -07:00
jdlrobson 89fee04f0b Drop unsupported skin CSS classes
Drop support for vectorMenu, vectorTabs and
vectorMenuCheckbox, body, menu selectors in preference
for standard selectors.

This change will impact a large amount of user scripts/styles but should
not impact any gadgets.

These classes were kept around for user scripts and styles however are not
needed internally. As we transition to a more maintainable skin menu
system, it is time to lose these selectors even though this will cause
disruption.

Vector now will use the mw-portlet class rather than the vector-menu
class in its own CSS styling, however it keeps the other classes to
allow differentiation of the different types of menu.

Changes to test: Previously the tests assumed all portlets were empty
when checking the classes. This is very rare, so its better to check
the classes of non-empty portlets, so several tests are updated
accordingly to drop the emptyPortlet class.

Bug: T262092
Change-Id: I1824335eb47d613c2a4804ec1f1106c0f4c16101
2020-10-01 19:50:24 +00:00
jdlrobson 4fad68ed0b Source footer data from SkinMustache
SkinMustache now provides this data in a slightly modified form.
Use it.

Change-Id: I060a8acfab6e7e2eea14e84fd4a5cad23677390b
2020-09-30 23:08:38 +00:00
Jan Drewniak 6907c81a15 [Storybook] Fix PNG/SVG asset resolution.
Fixes the missing images in the Logo story.

The current method of downloading the images into
docs/ui/assets and treating them as static assets
(with the start-storybook -s option) could be problematic
if that directory is deleted or "cleaned" before the
storybook build.

Instead, the images are now downloaded into
./storybook/resolve-imports and imported explicitly in the
code in Logo.stories.data.js.

* ./storybook/resolve-less-imports renamed to resolve-imports
* .gitignore is updated to reflect that
* Webpack config is updated with the `resolve-imports` path
* static option (-s) is removed from npm start script
* Images are explicitly imported in Logo.stories.data.js
* Type definitions are added for .svg and .png files

Change-Id: I242d229242c86a5784d6d4611d0b9c7049712dac
2020-09-25 12:52:05 +02:00
jenkins-bot 7a7f80c09a Merge "SearchBox: Add data-search-loc attribute" 2020-09-17 18:46:42 +00:00
Sam Smith 7cbc30ebac SearchBox: Add data-search-loc attribute
The mediawiki.searchSuggest protocol part of the SearchSatisfaction
instrumentation reads the value of an element with the "data-search-loc"
attribute and sets the event's inputLocation property accordingly.

Set the appropriate value for the attribute in
SkinVector::getTemplateData and render the attribute in
the SearchBox.mustache template.

Bug: T256100
Change-Id: I0edbd8906a042072b2055adc2889b083b2c6cac4
2020-09-17 18:24:24 +00:00
jdlrobson 34e70d44fc Fix the storybook instance
* Use `cp` over `ln` - the node resolver appears to
get tripped up by linked files.
* Fix a story referencing the wrong class

Follow up to I47da3046678117d5214354d1efe635f32f307dad

Bug: T263064
Change-Id: I80cb33ad70f9e6757dbe7f71b00539bec28abca9
2020-09-16 22:13:34 +00:00
Kunal Mehta bd2ee525b1 Update codesearch URL to wmcloud.org
Change-Id: I5aa4e362807208a1aef3476949238d4fe62858df
2020-09-03 16:20:40 -07:00
jdlrobson 5ac25943a2 Refactor: All messages should be listed from skin.json
This allows us easily to identify in templates what messages are
used and where, as well as allow us an easy way to tell when
messages are no longer being used.

Change-Id: I610224d551ebea54ae32e9e79901befe80cfd5ce
2020-08-28 17:12:10 +00:00
jenkins-bot feae33a4e6 Merge "Remove VectorBeforeFooter hook" 2020-08-13 22:36:09 +00:00
jdlrobson d24d858264 Cleanup: Drop unnecessary isLegacy checks
The has-logo property is redundant:
The Sidebar in legacy is its own component. The logo is always
rendered in the legacy sidebar.

data-emphasized-sidebar-action can be unconditionally sent
The legacy sidebar doesn't use it, so there is no need to conditionally
add a check for legacy

These two changes allow us to remove the isLegacy property in favor
of the single use of the isLegacy method.

Change-Id: Ie7ee3cec29b20d07db81799484627254d4a78f5f
2020-07-30 15:10:57 -07:00
Ammar Abdulhamid a7c983a2ed Remove VectorBeforeFooter hook
Bug: T255214
Change-Id: Iac66823119c7279f5e922b0e258602dd6c4ca5c4
2020-07-30 13:27:04 -07:00