Use Codex styles for buttons in language overlay (attempt 2)

* Replace all instances of mw-ui markup with Codex markup
* Use codex-search-styles
* Where codex-search-styles is not installed (e.g. 1.39)
register an alias which points to @wikimedia/codex as that is
available.

Bug: T340255
Bug: T340257
Change-Id: I4f3ddfb68ea6c033ee7a49729187f4ddbc8abe5c
This commit is contained in:
Jdlrobson
2023-12-08 22:03:21 +00:00
committed by Abijeet
parent 4456b68b5c
commit 6f9ffac1c3
14 changed files with 89 additions and 50 deletions

View File

@@ -133,6 +133,24 @@ class Hooks implements
return false;
}
/**
* Adds Codex styles in a way that is compatible with MLEB.
*
* @param OutputPage $out
*/
private function loadCodexStyles( OutputPage $out ) {
if ( version_compare( MW_VERSION, '1.41', '<' ) ) {
// codex-search-styles was added in 1.41 so in older versions for MLEB support
// we load the full module.
$out->addModuleStyles( '@wikimedia/codex' );
} else {
// Only needed for skins that do not load Codex.
if ( !in_array( $out->getSkin()->getSkinName(), [ 'minerva', 'vector-2022' ] ) ) {
$out->addModuleStyles( 'codex-search-styles' );
}
}
}
/**
* @param OutputPage $out
* @param Skin $skin
@@ -161,6 +179,8 @@ class Hooks implements
strpos( $out->getHTML(), 'mw-interlanguage-selector' ) === false
) {
$out->addModules( 'ext.uls.compactlinks' );
// Add styles for the default button in the page.
$this->loadCodexStyles( $out );
}
if ( is_string( $this->config->get( 'ULSGeoService' ) ) ) {
@@ -170,6 +190,7 @@ class Hooks implements
if ( $this->isEnabled() ) {
// Enable UI language selection for the user.
$out->addModules( 'ext.uls.interface' );
$this->loadCodexStyles( $out );
$title = $out->getTitle();
$isMissingPage = !$title || !$title->exists();