From f78870098d27d530246434707ada12f2454563ca Mon Sep 17 00:00:00 2001 From: Bryan Marchena Date: Thu, 25 Apr 2024 09:23:49 -0400 Subject: [PATCH] Update map width when toggling sidebar --- app/controllers/application.js | 6 ++++++ app/styles/layouts/_l-default.scss | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controllers/application.js b/app/controllers/application.js index f6e32593..61d6ae84 100644 --- a/app/controllers/application.js +++ b/app/controllers/application.js @@ -122,6 +122,12 @@ export default class ApplicationController extends Controller.extend( toggleLeftSideMenuVisibility() { this.leftSideMenuVisibilty = !this.leftSideMenuVisibilty; + const mapContainer = document.querySelector('.map-container'); + + if (this.leftSideMenuVisibilty) + mapContainer.setAttribute('class', 'map-container'); + else mapContainer.setAttribute('class', 'map-container full-width'); + this.metrics.trackEvent('MatomoTagManager', { category: 'Toggled Layer Menu Visibility', action: 'Toggled Layer Menu Visibility', diff --git a/app/styles/layouts/_l-default.scss b/app/styles/layouts/_l-default.scss index 605615ba..43d5f700 100644 --- a/app/styles/layouts/_l-default.scss +++ b/app/styles/layouts/_l-default.scss @@ -95,6 +95,11 @@ body { @include breakpoint(xlarge) { width: calc(100% - 18rem); } + + &.full-width { + width: 100%; + } + } body.index { @@ -193,7 +198,7 @@ body.index { ); } - & > .close-button { + & .close-button { position: relative; margin: 0;