Skip to content

Commit

Permalink
Fix: Change from Adapt.device to device directly (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverfoster authored Apr 8, 2024
1 parent 061361d commit eefd884
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions js/BoxMenuView.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Adapt from 'core/js/adapt';
import device from 'core/js/device';
import MenuView from 'core/js/views/menuView';
import BoxMenuItemView from './BoxMenuItemView';
import BoxMenuGroupView from './BoxMenuGroupView';
Expand Down Expand Up @@ -74,7 +75,7 @@ class BoxMenuView extends MenuView {
const config = this.model.get('_boxMenu');
const backgroundImages = config?._backgroundImage;
if (!backgroundImages) return;
const backgroundImage = backgroundImages[`_${Adapt.device.screenSize}`] ?? backgroundImages._small;
const backgroundImage = backgroundImages[`_${device.screenSize}`] ?? backgroundImages._small;
this.$el.toggleClass('has-bg-image', Boolean(backgroundImage));
this.$background
.css('background-image', backgroundImage ? 'url(' + backgroundImage + ')' : '');
Expand Down Expand Up @@ -121,7 +122,7 @@ class BoxMenuView extends MenuView {
setHeaderBackgroundImage(config, $header) {
const backgroundImages = config._backgroundImage;
if (!backgroundImages) return;
const backgroundImage = backgroundImages[`_${Adapt.device.screenSize}`] ?? backgroundImages._small;
const backgroundImage = backgroundImages[`_${device.screenSize}`] ?? backgroundImages._small;
$header.toggleClass('has-bg-image', Boolean(backgroundImage));
this.$headerBackground.css('background-image', backgroundImage ? 'url(' + backgroundImage + ')' : '');
}
Expand All @@ -139,7 +140,7 @@ class BoxMenuView extends MenuView {
setHeaderMinimumHeight(config, $header) {
const minimumHeights = config._minimumHeights;
if (!minimumHeights) return;
const minimumHeight = minimumHeights[`_${Adapt.device.screenSize}`] ?? minimumHeights._small;
const minimumHeight = minimumHeights[`_${device.screenSize}`] ?? minimumHeights._small;
$header
.toggleClass('has-min-height', Boolean(minimumHeight))
.css('min-height', minimumHeight ? minimumHeight + 'px' : '');
Expand Down

0 comments on commit eefd884

Please sign in to comment.