Drop Minerva LESS dependency

* Instead of repeating CSS already in Minerva instead use an element
"banner-container" already in use by CentralNotice (given this is also a banner)
This removes the need for positioning styles at Minerva is delegated to handle that.
* Rewrite existing rules using mediawiki ui variables to make clearer line-height
relates to iconography

Bug: T140807
Change-Id: I1bd3fb164bbb7866e5d32367c66afae5c1933bcb
This commit is contained in:
jdlrobson 2018-05-19 11:25:31 +02:00 committed by Florian Schmidt
parent 6e628532e4
commit 60929abb69
3 changed files with 8 additions and 15 deletions

View file

@ -78,7 +78,10 @@ class CookieWarningHooks {
MobileContext::singleton()->shouldDisplayMobileView();
$tpl->data['headelement'] .= Html::openElement(
'div',
[ 'class' => 'mw-cookiewarning-container' ]
// banner-container marks this as a banner for Minerva
// Note to avoid this class, in future we may want to make use of SiteNotice
// or banner display
[ 'class' => 'mw-cookiewarning-container banner-container' ]
) .
( $isMobile ? $form : '' ) .
Html::openElement(

View file

@ -1,7 +1,7 @@
@import 'minerva.variables';
@import 'minerva.mixins';
@import 'mediawiki.ui/variables.less';
@cookieWarningFontSize: 12px;
@contentPaddingTablet: @iconGutterWidth + @iconGutterWidth + @iconSize;
.mw-cookiewarning-container {
background-color: #ffffff;
@ -47,10 +47,8 @@
}
}
@media all and ( min-width: @deviceWidthTablet ) {
@media all and ( min-width: @width-breakpoint-tablet ) {
.mw-cookiewarning-container {
max-width: @contentMaxWidthTablet / @cookieWarningFontSize * 16;
margin: 0 @contentPaddingTablet;
line-height: @contentPaddingTablet;
.mw-cookiewarning-cimage {
@ -58,11 +56,3 @@
}
}
}
@media all and ( min-width: @wgMFDeviceWidthDesktop ) {
.mw-cookiewarning-container {
margin-left: auto;
margin-right: auto;
max-width: @contentMaxWidthTablet / @cookieWarningFontSize * 16;
}
}

View file

@ -45,7 +45,7 @@ class CookieWarningHooksTest extends MediaWikiLangTestCase {
// @codingStandardsIgnoreStart Generic.Files.LineLength
$expected =
str_replace( '$1', $expectedLink,
'<div class="mw-cookiewarning-container"><div class="mw-cookiewarning-text"><span>Cookies help us deliver our services. By using our services, you agree to our use of cookies.</span>$1<form method="POST"><input name="disablecookiewarning" class="mw-cookiewarning-dismiss" type="submit" value="OK"/></form></div></div>' );
'<div class="mw-cookiewarning-container banner-container"><div class="mw-cookiewarning-text"><span>Cookies help us deliver our services. By using our services, you agree to our use of cookies.</span>$1<form method="POST"><input name="disablecookiewarning" class="mw-cookiewarning-dismiss" type="submit" value="OK"/></form></div></div>' );
// @codingStandardsIgnoreEnd
}
$this->assertEquals( $expected, $headElement );