Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Media query start
Browse files Browse the repository at this point in the history
  • Loading branch information
AndresKasekamp committed Dec 22, 2023
1 parent a06d51e commit 0a01c19
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
12 changes: 11 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ require([

"./modules/goToLocation.js",
"esri/widgets/Measurement",
"./modules/mediaQuery.js"
], (
Conversion,

Expand All @@ -50,11 +51,15 @@ require([
initLegend,
initELevation,
goToLocation,
Measurement
Measurement,
initMediaQuery
) => {
/************************************************************
* Init scene (/w layers) and view
************************************************************/
// const mediaQuery = window.matchMedia('(max-width: 768px)');
// initMediaQuery.handleMediaQueryChange(mediaQuery)
// mediaQuery.addEventListener(initMediaQuery.handleMediaQueryChange);

const graphicsLayer = initLayers.setupGraphicsLayer();

Expand All @@ -81,10 +86,15 @@ require([

const view = initScene.setupWebView(scene);



/**************************************
* Adding a layer group, expand
**************************************/
view.when(() => {
// Media query


// Going to specified location at runtime
const locationArray = goToLocation.getLocation();

Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h2 id="header-title">

<calcite-shell-panel slot="panel-start" display-mode="float">

<calcite-action-bar slot="action-bar">
<calcite-action-bar slot="action-bar" class="responsive-action-bar">
<calcite-action data-action-id="layers" icon="layers" text="Layers" scale="l"></calcite-action>
<calcite-action data-action-id="layers-wms" icon="image-layer" text="WMS" scale="l"></calcite-action>
<calcite-action data-action-id="basemaps" icon="layer-basemap" text="Basemaps" scale="l">
Expand Down
11 changes: 11 additions & 0 deletions modules/mediaQuery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
define([], () => ({
handleMediaQueryChange: (mql) => {
const calciteActionBars = document.querySelectorAll('calcite-action');
if (mql.matches) {
calciteActionBars.forEach(bar => {
console.log(bar)
bar.scale ="m";
});
}
},
}));
18 changes: 18 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,21 @@ img {
width: 100%; /* Ensure the widget container takes full width */
height: 100%; /* Ensure the widget container takes full height */
}

.responsive-action-bar {
flex-wrap: wrap;
}

/*
@media screen and (max-width: 768px) {
.responsive-action-bar .calcite-action {
scale: "s";
}
}
*/



.calcite-action[data-action-id="layers"]) {
--calcite-action-scale: "m";
}

0 comments on commit 0a01c19

Please sign in to comment.