Skip to content

Commit 2d87376

Browse files
committed
Revert "update mapPages to map"
This reverts commit c9fd065.
1 parent 1130246 commit 2d87376

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { defineConfig } from "astro/config";
88
export default defineConfig({
99
site: "https://parixan.xyz",
1010
build: {
11-
format: "directory"
11+
format: "file"
1212
},
1313
prefetch: {
1414
prefetchAll: true

src/components/Popup.astro

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
</div>
1212

1313
<script>
14+
1415
const popup = document.querySelector(".state-popup") as HTMLElement;
1516
const popupStateName = document.querySelector(".state-popup__name") as HTMLElement;
1617
const popupStateInfo = document.querySelector(".state-popup__info") as HTMLElement;
@@ -44,35 +45,37 @@
4445
const clickX = event.pageX;
4546
const clickY = event.pageY;
4647

47-
let left = clickX - popupWidth / 2;
48-
let top = clickY - popupHeight / 2;
48+
let left = clickX - (popupWidth / 2);
49+
let top = clickY - (popupHeight / 2);
4950

5051
if (left + popupWidth > viewportWidth + scrollX - 20) {
51-
left = viewportWidth + scrollX - popupWidth - 20;
52+
left = viewportWidth + scrollX - popupWidth - 20;
5253
}
5354
if (left < scrollX + 20) {
54-
left = scrollX + 20;
55+
left = scrollX + 20;
5556
}
5657

5758
if (top + popupHeight > viewportHeight + scrollY - 20) {
58-
top = clickY - popupHeight - 20;
59+
top = clickY - popupHeight - 20;
5960
}
6061
if (top < scrollY + 20) {
61-
top = scrollY + 20;
62+
top = scrollY + 20;
6263
}
6364

6465
popup.style.left = `${left}px`;
6566
popup.style.top = `${top}px`;
67+
6668

6769
requestAnimationFrame(() => {
68-
popup.style.opacity = "1";
70+
popup.style.opacity = "1";
6971
});
70-
}
72+
}
73+
7174

72-
document.addEventListener("showStatePopup", ((e: CustomEvent) => {
75+
document.addEventListener("showStatePopup", ((e: CustomEvent) => {
7376
const { event, stateInfo } = e.detail;
7477
showPopup(event, stateInfo);
75-
}) as EventListener);
78+
}) as EventListener);
7679

7780
closePopup?.addEventListener("click", () => {
7881
popup.style.display = "none";
@@ -99,7 +102,7 @@
99102
const stateName = popupStateName.textContent;
100103
if (stateName) {
101104
const stateUrl = stateName.replace(/\s+/g, "").toLowerCase();
102-
window.location.href = `/map/${stateUrl}`;
105+
window.location.href = `/mapPages/${stateUrl}`;
103106
}
104107
});
105108

0 commit comments

Comments
 (0)