mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-25 06:36:32 +00:00
0dd994edda
Changes: * Minerva now maintains a MinervaUI - a simplified version of MobileUI that provides iconClass and buttonClass helpers. * Minerva now maintains its own ResourceLoaderParserMessageModule Remaining issues: * Main menu links to '#' * Unknown dependency errors are thrown due to the missing JS libraries e.g. mobile.watchstar thus JS based UI components are unusable e.g. search autocomplete, and edit button * Language button navigates to a missing special page without MobileFrontend (see T104660) Bug: T169569 Change-Id: I89e2e15faabab73b0cba91afc2f2c5e785edef29
54 lines
1.7 KiB
PHP
54 lines
1.7 KiB
PHP
<?php
|
|
|
|
/**
|
|
* MinervaUI.php
|
|
*/
|
|
|
|
// FIXME: Use OOUI PHP when available.
|
|
/**
|
|
* Helper methods for generating parts of the UI.
|
|
*/
|
|
class MinervaUI {
|
|
|
|
/**
|
|
* Get CSS classes for icons
|
|
* @param string $iconName
|
|
* @param string $iconType element or before
|
|
* @param string $additionalClassNames additional class names you want to associate
|
|
* with the iconed element
|
|
* @return string class name for use with HTML element
|
|
*/
|
|
public static function iconClass( $iconName, $iconType = 'element', $additionalClassNames = '' ) {
|
|
$base = 'mw-ui-icon';
|
|
$modifiers = 'mw-ui-icon-' . $iconType;
|
|
if ( $iconName ) {
|
|
$modifiers .= ' mw-ui-icon-' . $iconName;
|
|
}
|
|
return $base . ' ' . $modifiers . ' ' . $additionalClassNames;
|
|
}
|
|
|
|
/**
|
|
* Get CSS classes for a mediawiki ui semantic element
|
|
* @param string $base The base class
|
|
* @param string $modifier Type of anchor (progressive, constructive, destructive)
|
|
* @param string $additionalClassNames additional class names you want to associate
|
|
* with the iconed element
|
|
* @return string class name for use with HTML element
|
|
*/
|
|
public static function semanticClass( $base, $modifier, $additionalClassNames = '' ) {
|
|
$modifier = empty( $modifier ) ? '' : 'mw-ui-' . $modifier;
|
|
return $base . ' ' . $modifier . ' ' . $additionalClassNames;
|
|
}
|
|
|
|
/**
|
|
* Get CSS classes for buttons
|
|
* @param string $modifier Type of button (progressive, constructive, destructive)
|
|
* @param string $additionalClassNames additional class names you want to associate
|
|
* with the button element
|
|
* @return string class name for use with HTML element
|
|
*/
|
|
public static function buttonClass( $modifier = '', $additionalClassNames = '' ) {
|
|
return self::semanticClass( 'mw-ui-button', $modifier, $additionalClassNames );
|
|
}
|
|
}
|