Skip to content

Commit c9fd065

Browse files
committed
update mapPages to map
1 parent 786cd31 commit c9fd065

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
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: "file"
11+
format: "directory"
1212
},
1313
prefetch: {
1414
prefetchAll: true

src/components/Popup.astro

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

1313
<script>
14-
1514
const popup = document.querySelector(".state-popup") as HTMLElement;
1615
const popupStateName = document.querySelector(".state-popup__name") as HTMLElement;
1716
const popupStateInfo = document.querySelector(".state-popup__info") as HTMLElement;
@@ -45,37 +44,35 @@
4544
const clickX = event.pageX;
4645
const clickY = event.pageY;
4746

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

5150
if (left + popupWidth > viewportWidth + scrollX - 20) {
52-
left = viewportWidth + scrollX - popupWidth - 20;
51+
left = viewportWidth + scrollX - popupWidth - 20;
5352
}
5453
if (left < scrollX + 20) {
55-
left = scrollX + 20;
54+
left = scrollX + 20;
5655
}
5756

5857
if (top + popupHeight > viewportHeight + scrollY - 20) {
59-
top = clickY - popupHeight - 20;
58+
top = clickY - popupHeight - 20;
6059
}
6160
if (top < scrollY + 20) {
62-
top = scrollY + 20;
61+
top = scrollY + 20;
6362
}
6463

6564
popup.style.left = `${left}px`;
6665
popup.style.top = `${top}px`;
67-
6866

6967
requestAnimationFrame(() => {
70-
popup.style.opacity = "1";
68+
popup.style.opacity = "1";
7169
});
72-
}
73-
70+
}
7471

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

8077
closePopup?.addEventListener("click", () => {
8178
popup.style.display = "none";
@@ -102,7 +99,7 @@ document.addEventListener("showStatePopup", ((e: CustomEvent) => {
10299
const stateName = popupStateName.textContent;
103100
if (stateName) {
104101
const stateUrl = stateName.replace(/\s+/g, "").toLowerCase();
105-
window.location.href = `/mapPages/${stateUrl}`;
102+
window.location.href = `/map/${stateUrl}`;
106103
}
107104
});
108105

0 commit comments

Comments
 (0)