Add Reset Button

This commit is contained in:
CherryKitten 2022-10-01 12:34:36 +02:00 committed by Jasmin
parent 31d09e30fa
commit 0cc7cc15a6
3 changed files with 15 additions and 1 deletions

View file

@ -233,6 +233,12 @@
<!-- HAMBURGER MENU END -->
<!-- #region Emergency button -->
<button
id="reset-button"
class="bg-green-800 bottom-0 sticky text-white px-4 py-3 md:absolute md:right-2 md:bottom-20 md:rounded-full"
>
Reset
</button>
<button
id="emergency-button"
class="bg-red-800 bottom-0 sticky text-white px-4 py-3 z-emergencyButton md:absolute md:right-2 md:bottom-6 md:rounded-full"

View file

@ -4,7 +4,7 @@ import { setupHamburger } from "./ts/hamburger";
import { initializeMap } from "./ts/map";
import "@fontsource/ubuntu/latin.css";
import { setupLegend } from "./ts/legend";
import { setupEmergencyButton } from "./ts/emergency-button";
import { setupEmergencyButton, setupResetButton } from "./ts/buttons";
import { addGoatCounter } from "./ts/goatcounter";
document.addEventListener("DOMContentLoaded", () => {
@ -13,6 +13,7 @@ document.addEventListener("DOMContentLoaded", () => {
setupHamburger();
setupLegend();
setupEmergencyButton();
setupResetButton();
if (import.meta.env.VITE_QUEER_LEXIKON_PRIVATE === "true") {
addGoatCounter();

View file

@ -9,3 +9,10 @@ export const setupEmergencyButton = () => {
location.replace(NAVIGATE_TO_URI);
});
};
export const setupResetButton = () => {
const btn = <HTMLButtonElement>document.getElementById("reset-button");
btn?.addEventListener("click", () => {
window.location.reload();
});
};