diff --git a/interfaces/IBF-dashboard/src/app/components/map-controls/map-controls.component.html b/interfaces/IBF-dashboard/src/app/components/map-controls/map-controls.component.html index 3bca916e2..904b111e2 100644 --- a/interfaces/IBF-dashboard/src/app/components/map-controls/map-controls.component.html +++ b/interfaces/IBF-dashboard/src/app/components/map-controls/map-controls.component.html @@ -1,3 +1 @@ -
- -
+ diff --git a/interfaces/IBF-dashboard/src/app/components/map-controls/map-controls.component.scss b/interfaces/IBF-dashboard/src/app/components/map-controls/map-controls.component.scss index dfa04dc36..ba5f20823 100644 --- a/interfaces/IBF-dashboard/src/app/components/map-controls/map-controls.component.scss +++ b/interfaces/IBF-dashboard/src/app/components/map-controls/map-controls.component.scss @@ -1,7 +1,6 @@ -div { +app-admin-level { position: absolute; top: -10px; left: 45px; z-index: 500; - max-width: 60%; } diff --git a/interfaces/IBF-dashboard/src/app/components/map/map.component.ts b/interfaces/IBF-dashboard/src/app/components/map/map.component.ts index 51c484011..d381c12b4 100644 --- a/interfaces/IBF-dashboard/src/app/components/map/map.component.ts +++ b/interfaces/IBF-dashboard/src/app/components/map/map.component.ts @@ -330,7 +330,10 @@ export class MapComponent implements AfterViewInit, OnDestroy { index === self.findIndex((t) => t.name === value.name), ); // deduplicate based on name (for e.g. waterpoints_internal) - this.legendDiv.innerHTML = this.mapLegendService.getLegendTitle(); + let detailsString = `
${this.mapLegendService.getLegendTitle()} + +
+
`; for (const layer of layersToShow.sort(this.sortLayers)) { const elements = []; switch (layer.type) { @@ -372,9 +375,12 @@ export class MapComponent implements AfterViewInit, OnDestroy { } for (const element of elements) { - this.legendDiv.innerHTML += element; + detailsString += element; } } + detailsString += '
'; + + this.legendDiv.innerHTML = detailsString; } private isMultiLinePointLayer(layerName: IbfLayerName): boolean { diff --git a/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.html b/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.html index 2e8971b0a..cfd3893f8 100644 --- a/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.html +++ b/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.html @@ -1,92 +1,69 @@ -
- + - - - - - - Layers - - - - - - - - - - - {{ - 'layers-menu.menu-toggle-label' | translate - }} - - - - - - - - -
+ {{ 'layers-menu.menu-toggle-label' | translate }} +
+ +
+ + + + + + + - - - -
-
- - {{ layer.label }} - - - - -
-
-
-
-
+ class="single-layer-toggler" + > + + + {{ layer.label }} + + + + + + + +
diff --git a/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.scss b/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.scss index bf7fc80c2..79a087bea 100644 --- a/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.scss +++ b/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.scss @@ -1,105 +1,87 @@ -.ibf-map-layer-control { - position: absolute; - top: 10px; - bottom: 0; - right: 0; - width: 28%; - - ion-menu { - --width: 100%; - --background: transparent; - - ion-content { - --background: transparent; - } - - ion-content::part(scroll), - ion-content::part(background) { - height: max-content; - } +$z-index: 900; +$menu-width: 13vw; +$menu-width-small-res: 16vw; +$toggle-button-bottom: 1.5rem; +$toggle-button-right: 0; +$toggle-button-height: 2.26rem; +$line-height: 1.5rem; + +#layer-menu-container { + position: fixed; + z-index: $z-index; + bottom: $toggle-button-bottom; + right: $toggle-button-right; + width: $menu-width; + height: $line-height; + display: flex; + flex-direction: column; + max-height: calc($toggle-button-height + ($line-height * 10)); + @media (max-width: 1280px) { + width: $menu-width-small-res; } - ion-menu::part(backdrop) { - display: none; - background: transparent; - } - - ion-menu-toggle { - cursor: pointer; - - ion-toolbar { - --min-height: 36px; - - ion-title { - font-size: 12px; + #layer-menu-toggle-button { + width: 100%; + height: $toggle-button-height; + min-height: $toggle-button-height; + --border-radius: 0.25rem 0 0 0; + div { + width: 100%; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + ion-icon { + font-size: 1rem; } } } - ion-row { - min-height: 36px; - border: 1px solid var(--ion-color-ibf-no-alert-primary); - border-top: none; - } - ion-item { - width: 100%; - --min-height: 36px; - --padding-bottom: 0; - --padding-top: 0; - --padding-start: 4px; - --padding-end: 4px; - --inner-padding-start: 0; - --inner-padding-end: 0; + #layer-menu { + bottom: 0px; + overflow-y: auto; - ion-spinner { - width: 18px; - height: 18px; + ion-row { + min-height: $line-height; + border: 1px solid var(--ion-color-ibf-no-alert-primary); + border-top: none; } - .matrix-toggler { - width: 18px; - height: 18px; - background-color: #fff; - border: 2px solid var(--ion-color-ibf-no-alert-primary); - cursor: pointer; - - &.matrix-check { - border-radius: 2px; + ion-item { + width: 98%; + --min-height: $line-height; + --padding-bottom: 0; + --padding-top: 0; + --padding-start: 0.25rem; + --padding-end: 0.25rem; + --inner-padding-start: 0; + --inner-padding-end: 0; + + ion-spinner { + width: 1rem; + height: 1rem; } - &.matrix-radio { - border-radius: 50%; + .single-layer-toggler { + font-size: 1.3rem; + cursor: pointer; + color: var(--ion-color-ibf-no-alert-primary); } - .matrix-check-mark { - width: 16px; - height: 16px; - background-color: var(--ion-color-ibf-no-alert-primary); - stroke: #fff; - stroke-width: 4px; + ion-label { + width: 80%; + font-size: 0.75rem; } - .matrix-radio-circle { - width: 14px; - height: 14px; - background-color: var(--ion-color-ibf-no-alert-primary); - border: 2px solid #fff; - border-radius: 50%; - } - } - ion-label { - width: 80%; - font-size: 12px; - } - - .info-button { - --background-hover: #fff; - --ripple-color: #fff; - } - .info-icon { - font-size: 24px; + .info-button { + --background-hover: #fff; + --ripple-color: #fff; + } + .info-icon { + font-size: 1.3rem; - cursor: pointer; + cursor: pointer; + } } } } diff --git a/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.ts b/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.ts index 5458dac44..c672049a8 100644 --- a/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.ts +++ b/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.ts @@ -29,6 +29,11 @@ export class MatrixComponent implements OnDestroy { public IbfLayerGroup = IbfLayerGroup; public hideLayerControlToggleButton = false; + private BUTTON_HEIGHT = 2.26; + private LINE_HEIGHT = 1.5; + + public isLayerMenuOpen = false; + constructor( private analyticsService: AnalyticsService, public eventService: EventService, @@ -57,6 +62,7 @@ export class MatrixComponent implements OnDestroy { if (newLayerIndex >= 0) { this.layers.splice(newLayerIndex, 1, newLayer); } else { + this.isLayerMenuOpen = false; if (newLayer.group !== IbfLayerGroup.adminRegions) { this.layers.push(newLayer); } @@ -128,4 +134,18 @@ export class MatrixComponent implements OnDestroy { layerGroup, ); } + + public toggleLayerMenu(): void { + this.isLayerMenuOpen = !this.isLayerMenuOpen; + } + + public getLayerMenuContainerHeightInRem = (): number => { + if (!this.isLayerMenuOpen) { + return this.BUTTON_HEIGHT; + } + return ( + (this.getLayersInOrder().length + 1) * this.LINE_HEIGHT + + this.BUTTON_HEIGHT + ); + }; } diff --git a/interfaces/IBF-dashboard/src/app/services/map-legend.service.ts b/interfaces/IBF-dashboard/src/app/services/map-legend.service.ts index 3207063bb..c73db370f 100644 --- a/interfaces/IBF-dashboard/src/app/services/map-legend.service.ts +++ b/interfaces/IBF-dashboard/src/app/services/map-legend.service.ts @@ -25,7 +25,7 @@ enum SingleRowLegendType { providedIn: 'root', }) export class MapLegendService { - private legendDivTitle = `
Map Legend
`; + private legendDivTitle = `
Map Legend
`; public eventState: EventState; private country: Country; @@ -363,13 +363,13 @@ export class MapLegendService { const labelStyle = type === SingleRowLegendType.pin && label !== IbfLayerLabel.typhoonTrack - ? 'style="padding-top: 2px"' + ? 'style="padding-top: 2px;"' : ''; return ` - +
${pinImg}
- ${label} + ${label}
`; }; diff --git a/interfaces/IBF-dashboard/src/global.scss b/interfaces/IBF-dashboard/src/global.scss index 39e259aa6..886914e27 100644 --- a/interfaces/IBF-dashboard/src/global.scss +++ b/interfaces/IBF-dashboard/src/global.scss @@ -63,10 +63,39 @@ .info { padding: 6px 8px; - font: 12px Arial, Helvetica, sans-serif; + font: 0.75rem Arial, Helvetica, sans-serif; background: white; - box-shadow: 0 0 15px rgba(0, 0, 0, 0.2); - border-radius: 5px; + box-shadow: 0 0 0.9375rem rgba(0, 0, 0, 0.2); + border-radius: 0.3125rem; + width: 13vw; + + details { + summary { + list-style-type: none; + + .legend-header { + display: flex; + flex-direction: row; + justify-content: space-between; + cursor: pointer; + + .icon-up { + display: block; + } + .icon-down { + display: none; + } + } + } + &[open] summary { + .icon-down { + display: block; + } + .icon-up { + display: none; + } + } + } } .leaflet-popup-content-wrapper {