mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-12-03 11:57:13 +00:00
Merge "Adjust notification popup arrow in small screens"
This commit is contained in:
commit
b818832d4e
|
@ -108,6 +108,19 @@
|
|||
.addClass( 'mw-echo-ui-notificationBadgeButtonPopupWidget-footer' )
|
||||
.append( footerButtonGroupWidget.$element );
|
||||
|
||||
const screenWidth = $( window ).width();
|
||||
// FIXME 639 is @max-width-breakpoint-mobile value in wikimedia-ui-base.less,
|
||||
// should be updated with aproppriate JS exported Codex token once available, T366622
|
||||
const maxWidthBreakPoint = 639;
|
||||
const isUnderBreakpointMobile = screenWidth < maxWidthBreakPoint;
|
||||
const mql = window.matchMedia( `(max-width: ${ maxWidthBreakPoint }px)` );
|
||||
const matchMedia = function ( event ) {
|
||||
if ( event.matches ) {
|
||||
this.popup.containerPadding = 0;
|
||||
} else {
|
||||
this.popup.containerPadding = 20;
|
||||
}
|
||||
};
|
||||
this.popup = new OO.ui.PopupWidget( {
|
||||
$content: this.notificationsWidget.$element,
|
||||
$footer: $footer,
|
||||
|
@ -115,7 +128,7 @@
|
|||
hideWhenOutOfView: false,
|
||||
autoFlip: false,
|
||||
autoClose: true,
|
||||
containerPadding: 20,
|
||||
containerPadding: isUnderBreakpointMobile ? 0 : 20,
|
||||
$floatableContainer: this.$element,
|
||||
// Also ignore clicks from the nested action menu items, that
|
||||
// actually exist in the overlay
|
||||
|
@ -130,6 +143,7 @@
|
|||
),
|
||||
classes: [ 'mw-echo-ui-notificationBadgeButtonPopupWidget-popup' ]
|
||||
} );
|
||||
mql.addEventListener( 'change', matchMedia.bind( this ) );
|
||||
// Append the popup to the overlay
|
||||
this.$overlay.append( this.popup.$element );
|
||||
|
||||
|
|
Loading…
Reference in a new issue