Skip to content

Commit 4599146

Browse files
committed
fix relative import/url issue in css background image
1 parent 5cb625a commit 4599146

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/App.scss

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ body {
6161
}
6262

6363
// customize zoom button styles
64-
$background-size: 64px;
6564
$border-radius: 6px;
6665

6766
.leaflet-bottom .leaflet-control {
@@ -75,20 +74,20 @@ $border-radius: 6px;
7574
border-bottom: none;
7675
background-color: unset;
7776
}
77+
78+
.leaflet-touch .leaflet-bar a {
79+
background-size: 64px;
80+
}
7881
.leaflet-touch .leaflet-bar a:first-child {
7982
border-top-left-radius: $border-radius;
8083
border-top-right-radius: $border-radius;
8184

82-
background-image: url(http://localhost:3000//LUTI_Zoom_Icon.svg);
83-
background-size: $background-size;
8485
background-position: top -10px left -15px;
8586
}
8687
.leaflet-touch .leaflet-bar a:last-child {
8788
border-bottom-left-radius: $border-radius;
8889
border-bottom-right-radius: $border-radius;
8990

90-
background-image: url(http://localhost:3000//LUTI_Zoom_Icon.svg);
91-
background-size: $background-size;
9291
background-position: bottom -11px left -15px;
9392
}
9493
.leaflet-touch .leaflet-bar a:hover {

src/components/InfoBox.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,19 @@ export default function InfoBox({ desc, displayMode, title, url }) {
1717
const ref = useRef(null);
1818

1919
useEffect(() => {
20-
const intro = document.querySelector(".leaflet-control-zoom"); // this except use the new buttons
20+
const controlLinks = document.querySelectorAll(
21+
".leaflet-touch .leaflet-bar a"
22+
);
23+
if (!controlLinks || controlLinks.length !== 2) return;
24+
25+
const backgroundImage = "url(/LUTI_Zoom_Icon.svg)";
26+
27+
controlLinks[0].style.backgroundImage = backgroundImage;
28+
controlLinks[1].style.backgroundImage = backgroundImage;
29+
}, []);
30+
31+
useEffect(() => {
32+
const intro = document.querySelector(".leaflet-control-zoom");
2133
const height = ref.current.clientHeight;
2234

2335
if (!height || !intro) return;

0 commit comments

Comments
 (0)