@sofidevo/astro-dynamic-header 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/Header.astro +0 -31
package/package.json
CHANGED
package/src/Header.astro
CHANGED
|
@@ -39,37 +39,6 @@ const {
|
|
|
39
39
|
} = Astro.props;
|
|
40
40
|
---
|
|
41
41
|
|
|
42
|
-
<script>
|
|
43
|
-
class HamburgerController {
|
|
44
|
-
private hamburgerBtn: HTMLElement | null;
|
|
45
|
-
private mobileMenu: HTMLElement | null;
|
|
46
|
-
|
|
47
|
-
constructor() {
|
|
48
|
-
this.hamburgerBtn = document.getElementById("hamburger-btn");
|
|
49
|
-
this.mobileMenu = document.getElementById("mobile-header-menu");
|
|
50
|
-
this.init();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
private init(): void {
|
|
54
|
-
if (this.hamburgerBtn && this.mobileMenu) {
|
|
55
|
-
this.hamburgerBtn.addEventListener("click", () => this.toggleMenu());
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
private toggleMenu(): void {
|
|
60
|
-
if (this.hamburgerBtn && this.mobileMenu) {
|
|
61
|
-
this.hamburgerBtn.classList.toggle("is-active");
|
|
62
|
-
this.mobileMenu.classList.toggle("is-active");
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Auto-initialize when DOM is ready
|
|
68
|
-
document.addEventListener('DOMContentLoaded', () => {
|
|
69
|
-
new HamburgerController();
|
|
70
|
-
});
|
|
71
|
-
</script>
|
|
72
|
-
|
|
73
42
|
<div class={`header__container header__container--${headerType}`} style={`z-index: ${zIndex};`}>
|
|
74
43
|
<header class={`header header--${headerType}`} style={`background-color: ${backgroundColor}; backdrop-filter: ${backdropBlur}; -webkit-backdrop-filter: ${backdropBlur};`}>
|
|
75
44
|
<a href={homeUrl}>
|