mirror of
https://github.com/Queer-Lexikon/regenbogenkarte
synced 2024-11-24 21:23:19 +00:00
fixup! feat: add second button which is better aligned
This commit is contained in:
parent
cc0ef57631
commit
cc1ce48234
2 changed files with 13 additions and 7 deletions
4
main.ts
4
main.ts
|
@ -4,7 +4,7 @@ import { setupInfoButton } from "./ts/info-menu";
|
|||
import { initializeMap } from "./ts/map";
|
||||
import "@fontsource/ubuntu/latin.css";
|
||||
import { setupLegend } from "./ts/legend";
|
||||
import { setupEmergencyButton, setupResetButton, setupHeaderButton } from "./ts/buttons";
|
||||
import { setupEmergencyButton, setupResetButton, setupHamburgerButton } from "./ts/buttons";
|
||||
import { addGoatCounter } from "./ts/goatcounter";
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
|
@ -14,7 +14,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
setupLegend();
|
||||
setupEmergencyButton();
|
||||
setupResetButton();
|
||||
setupHeaderButton();
|
||||
setupHamburgerButton();
|
||||
|
||||
if (import.meta.env.VITE_QUEER_LEXIKON_PRIVATE === "true") {
|
||||
addGoatCounter();
|
||||
|
|
|
@ -17,10 +17,16 @@ export const setupResetButton = () => {
|
|||
});
|
||||
};
|
||||
|
||||
export const setupHeaderButton = () => {
|
||||
const btn = <HTMLButtonElement>document.getElementById("header-button");
|
||||
export const setupHamburgerButton = () => {
|
||||
let isOpen = false;
|
||||
const header = <HTMLElement>document.getElementById("mobile-header");
|
||||
btn?.addEventListener("click", () => {
|
||||
header.classList.toggle("max-md:hidden");
|
||||
});
|
||||
const hamburger = <HTMLButtonElement>document.getElementById("hamburger-button")!;
|
||||
|
||||
document.querySelectorAll<HTMLButtonElement>(".js-header-button").forEach((btn) =>
|
||||
btn.addEventListener("click", () => {
|
||||
header.classList.toggle("max-md:hidden", isOpen);
|
||||
hamburger.classList.toggle("hidden", !isOpen);
|
||||
isOpen = !isOpen;
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue