mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-14 09:54:45 +00:00
c5d09c0288
Changes: * MinervaUI will now prefix any icons with `minerva` * Update definitions in skin.json, retaining selectors for cached HTML for icons that are rendered via PHP. * In I9021c53c2c04bdd7ce395eed33d89986acbfea6d watch and watched and arrow are moved to MobileFrontend so are removed from the RL module skins.minerva.icons.images.scripts as they are not used directly in this repo. user and anonymous are no longer used so also removed. * Presentation of userpage now belongs to MobileFrontend. Icons are styles were moved there in depends on. They are retained in skin.json to support cached HTML as user pages are subject to cache. They can be removed in a week. * In code review we noticed the anonymous icon was badly named. We rename to login. No caching implications. * Main menu icons are now prefixed with minerva rather than mf to reflect where they come from. Depends-On: I9021c53c2c04bdd7ce395eed33d89986acbfea6d Bug: T182162 Change-Id: I93264024f4915fc910c792b1905b89cdc6b8b546
57 lines
1.9 KiB
PHP
57 lines
1.9 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
|
|
* @param string $glyphPrefix optional prefix for icons. Defaults to minerva.
|
|
* @return string class name for use with HTML element
|
|
*/
|
|
public static function iconClass( $iconName, $iconType = 'element', $additionalClassNames = '',
|
|
$glyphPrefix = 'minerva'
|
|
) {
|
|
$base = 'mw-ui-icon';
|
|
$modifiers = 'mw-ui-icon-' . $iconType;
|
|
if ( $iconName ) {
|
|
$modifiers .= ' mw-ui-icon-' . $glyphPrefix . '-' . $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 );
|
|
}
|
|
}
|