@easy-web/content-blocks 1.0.0
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/README.md +332 -0
- package/dist/components/__tests__/UniversalMedia.test.d.ts +2 -0
- package/dist/components/__tests__/UniversalMedia.test.d.ts.map +1 -0
- package/dist/components/__tests__/UniversalMedia.test.js +46 -0
- package/dist/components/__tests__/UniversalMedia.test.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/__tests__/notFound.test.d.ts +2 -0
- package/dist/schemas/__tests__/notFound.test.d.ts.map +1 -0
- package/dist/schemas/__tests__/notFound.test.js +29 -0
- package/dist/schemas/__tests__/notFound.test.js.map +1 -0
- package/dist/schemas/galleries.d.ts +319 -0
- package/dist/schemas/galleries.d.ts.map +1 -0
- package/dist/schemas/galleries.js +136 -0
- package/dist/schemas/galleries.js.map +1 -0
- package/dist/schemas/notFound.d.ts +35 -0
- package/dist/schemas/notFound.d.ts.map +1 -0
- package/dist/schemas/notFound.js +30 -0
- package/dist/schemas/notFound.js.map +1 -0
- package/package.json +51 -0
- package/src/components/.gitkeep +0 -0
- package/src/components/BlogPostCard.astro +79 -0
- package/src/components/Card.astro +70 -0
- package/src/components/CardGrid.astro +29 -0
- package/src/components/ContactSection.astro +73 -0
- package/src/components/CtaSection.astro +82 -0
- package/src/components/DraftBanner.astro +33 -0
- package/src/components/Footer.astro +81 -0
- package/src/components/GalleryCarousel.astro +296 -0
- package/src/components/GalleryFeatureHighlight.astro +153 -0
- package/src/components/GalleryHeroSlider.astro +362 -0
- package/src/components/GalleryImageGrid.astro +143 -0
- package/src/components/GalleryLightboxGrid.astro +353 -0
- package/src/components/GalleryMasonryGrid.astro +127 -0
- package/src/components/GallerySection.astro +69 -0
- package/src/components/Header.astro +210 -0
- package/src/components/HeaderCentered.astro +231 -0
- package/src/components/HeaderFlyout.astro +373 -0
- package/src/components/HeaderHideOnScroll.astro +237 -0
- package/src/components/Hero.astro +78 -0
- package/src/components/LanguageNotice.astro +32 -0
- package/src/components/LanguageSwitch.astro +67 -0
- package/src/components/LegalLayout.astro +53 -0
- package/src/components/NotFound.astro +124 -0
- package/src/components/Prose.astro +156 -0
- package/src/components/Section.astro +37 -0
- package/src/components/ThemeToggle.astro +82 -0
- package/src/components/UniversalMedia.astro +102 -0
- package/src/components/__tests__/UniversalMedia.test.ts +65 -0
- package/src/schemas/__tests__/notFound.test.ts +32 -0
- package/src/schemas/galleries.ts +152 -0
- package/src/schemas/notFound.ts +33 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* Header – responsive site header with navigation, theme toggle, and language switch.
|
|
4
|
+
* Pure Astro component with minimal vanilla JS for mobile menu.
|
|
5
|
+
*/
|
|
6
|
+
import ThemeToggle from './ThemeToggle.astro';
|
|
7
|
+
import LanguageSwitch from './LanguageSwitch.astro';
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
siteName: string;
|
|
11
|
+
navItems: Array<{ label: string; href: string }>;
|
|
12
|
+
currentLang: string;
|
|
13
|
+
pathname: string;
|
|
14
|
+
/** Explicit brand link href. Falls back to `/` (de) or `/${currentLang}/` (other). */
|
|
15
|
+
brandHref?: string;
|
|
16
|
+
/** Explicit alternate locale URL to pass to LanguageSwitch. */
|
|
17
|
+
alternateHref?: string;
|
|
18
|
+
/** Accessible label for the mobile menu toggle button. */
|
|
19
|
+
menuLabel?: string;
|
|
20
|
+
/** Optional logo URL. When provided, renders an <img> in the brand area instead of site name text. */
|
|
21
|
+
logo?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const { siteName, navItems, currentLang, pathname, brandHref, alternateHref, menuLabel = 'Toggle navigation menu', logo } = Astro.props;
|
|
25
|
+
const navId = `ew-header-nav-${Math.random().toString(36).slice(2, 9)}`;
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
<header class="ew-header" data-testid="header-classic">
|
|
29
|
+
<div class="ew-header__inner">
|
|
30
|
+
<a href={brandHref ?? (currentLang === 'de' ? '/' : `/${currentLang}/`)} class="ew-header__brand">
|
|
31
|
+
{logo ? <img src={logo} alt={siteName} class="ew-header__logo" /> : siteName}
|
|
32
|
+
</a>
|
|
33
|
+
|
|
34
|
+
<button
|
|
35
|
+
type="button"
|
|
36
|
+
class="ew-header__menu-btn"
|
|
37
|
+
aria-label={menuLabel}
|
|
38
|
+
aria-expanded="false"
|
|
39
|
+
aria-controls={navId}
|
|
40
|
+
data-testid="mobile-menu-toggle"
|
|
41
|
+
>
|
|
42
|
+
<svg class="ew-header__menu-icon ew-header__menu-icon--open" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true">
|
|
43
|
+
<line x1="3" y1="6" x2="21" y2="6"></line>
|
|
44
|
+
<line x1="3" y1="12" x2="21" y2="12"></line>
|
|
45
|
+
<line x1="3" y1="18" x2="21" y2="18"></line>
|
|
46
|
+
</svg>
|
|
47
|
+
<svg class="ew-header__menu-icon ew-header__menu-icon--close" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true">
|
|
48
|
+
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
49
|
+
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
50
|
+
</svg>
|
|
51
|
+
</button>
|
|
52
|
+
|
|
53
|
+
<nav id={navId} class="ew-header__nav" aria-label="Main navigation">
|
|
54
|
+
<ul class="ew-header__links">
|
|
55
|
+
{navItems.map((item) => (
|
|
56
|
+
<li>
|
|
57
|
+
<a href={item.href} class:list={['ew-header__link', { 'ew-header__link--active': pathname === item.href }]}>
|
|
58
|
+
{item.label}
|
|
59
|
+
</a>
|
|
60
|
+
</li>
|
|
61
|
+
))}
|
|
62
|
+
</ul>
|
|
63
|
+
<div class="ew-header__actions">
|
|
64
|
+
<slot name="actions">
|
|
65
|
+
<ThemeToggle />
|
|
66
|
+
<LanguageSwitch currentLang={currentLang} pathname={pathname} alternateHref={alternateHref} />
|
|
67
|
+
</slot>
|
|
68
|
+
</div>
|
|
69
|
+
</nav>
|
|
70
|
+
</div>
|
|
71
|
+
</header>
|
|
72
|
+
|
|
73
|
+
<style>
|
|
74
|
+
.ew-header {
|
|
75
|
+
position: sticky;
|
|
76
|
+
top: 0;
|
|
77
|
+
z-index: 100;
|
|
78
|
+
background: var(--ew-surface);
|
|
79
|
+
border-bottom: 1px solid var(--ew-border);
|
|
80
|
+
}
|
|
81
|
+
.ew-header__inner {
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
justify-content: space-between;
|
|
85
|
+
max-width: 72rem;
|
|
86
|
+
margin: 0 auto;
|
|
87
|
+
padding: var(--ew-space-3) var(--ew-space-5);
|
|
88
|
+
}
|
|
89
|
+
.ew-header__brand {
|
|
90
|
+
font-family: var(--ew-font-sans);
|
|
91
|
+
font-size: var(--ew-text-lg);
|
|
92
|
+
font-weight: 700;
|
|
93
|
+
color: var(--ew-on-surface);
|
|
94
|
+
text-decoration: none;
|
|
95
|
+
letter-spacing: -0.01em;
|
|
96
|
+
}
|
|
97
|
+
.ew-header__brand:hover {
|
|
98
|
+
color: var(--ew-primary);
|
|
99
|
+
}
|
|
100
|
+
.ew-header__logo {
|
|
101
|
+
height: 1.5rem;
|
|
102
|
+
width: auto;
|
|
103
|
+
display: block;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* Mobile menu button */
|
|
107
|
+
.ew-header__menu-btn {
|
|
108
|
+
display: none;
|
|
109
|
+
background: transparent;
|
|
110
|
+
border: none;
|
|
111
|
+
color: var(--ew-on-surface);
|
|
112
|
+
cursor: pointer;
|
|
113
|
+
padding: var(--ew-space-1);
|
|
114
|
+
}
|
|
115
|
+
.ew-header__menu-btn:focus-visible {
|
|
116
|
+
outline: 2px solid var(--ew-primary);
|
|
117
|
+
outline-offset: 2px;
|
|
118
|
+
}
|
|
119
|
+
.ew-header__menu-icon--close { display: none; }
|
|
120
|
+
|
|
121
|
+
/* Nav */
|
|
122
|
+
.ew-header__nav {
|
|
123
|
+
display: flex;
|
|
124
|
+
align-items: center;
|
|
125
|
+
gap: var(--ew-space-5);
|
|
126
|
+
}
|
|
127
|
+
.ew-header__links {
|
|
128
|
+
display: flex;
|
|
129
|
+
list-style: none;
|
|
130
|
+
margin: 0;
|
|
131
|
+
padding: 0;
|
|
132
|
+
gap: var(--ew-space-1);
|
|
133
|
+
}
|
|
134
|
+
.ew-header__link {
|
|
135
|
+
display: block;
|
|
136
|
+
padding: var(--ew-space-2) var(--ew-space-3);
|
|
137
|
+
border-radius: var(--ew-radius-md);
|
|
138
|
+
color: var(--ew-muted);
|
|
139
|
+
font-family: var(--ew-font-sans);
|
|
140
|
+
font-size: var(--ew-text-sm);
|
|
141
|
+
font-weight: 500;
|
|
142
|
+
text-decoration: none;
|
|
143
|
+
}
|
|
144
|
+
.ew-header__link:hover {
|
|
145
|
+
color: var(--ew-on-surface);
|
|
146
|
+
background: var(--ew-surface-muted);
|
|
147
|
+
}
|
|
148
|
+
.ew-header__link--active {
|
|
149
|
+
color: var(--ew-on-surface);
|
|
150
|
+
background: var(--ew-surface-muted);
|
|
151
|
+
}
|
|
152
|
+
.ew-header__actions {
|
|
153
|
+
display: flex;
|
|
154
|
+
align-items: center;
|
|
155
|
+
gap: var(--ew-space-2);
|
|
156
|
+
border-left: 1px solid var(--ew-border);
|
|
157
|
+
padding-left: var(--ew-space-3);
|
|
158
|
+
margin-left: var(--ew-space-1);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/* Mobile: <=768px */
|
|
162
|
+
@media (max-width: 768px) {
|
|
163
|
+
.ew-header__menu-btn {
|
|
164
|
+
display: flex;
|
|
165
|
+
}
|
|
166
|
+
.ew-header__nav {
|
|
167
|
+
display: none;
|
|
168
|
+
position: absolute;
|
|
169
|
+
top: 100%;
|
|
170
|
+
left: 0;
|
|
171
|
+
right: 0;
|
|
172
|
+
flex-direction: column;
|
|
173
|
+
background: var(--ew-surface);
|
|
174
|
+
border-bottom: 1px solid var(--ew-border);
|
|
175
|
+
padding: var(--ew-space-4) var(--ew-space-5);
|
|
176
|
+
gap: var(--ew-space-4);
|
|
177
|
+
}
|
|
178
|
+
.ew-header__nav[data-open] {
|
|
179
|
+
display: flex;
|
|
180
|
+
}
|
|
181
|
+
.ew-header__links {
|
|
182
|
+
flex-direction: column;
|
|
183
|
+
gap: var(--ew-space-1);
|
|
184
|
+
}
|
|
185
|
+
.ew-header__actions {
|
|
186
|
+
border-left: none;
|
|
187
|
+
padding-left: 0;
|
|
188
|
+
margin-left: 0;
|
|
189
|
+
padding-top: var(--ew-space-3);
|
|
190
|
+
border-top: 1px solid var(--ew-border);
|
|
191
|
+
}
|
|
192
|
+
/* Toggle icon swap when open */
|
|
193
|
+
.ew-header__menu-btn[aria-expanded="true"] .ew-header__menu-icon--open { display: none; }
|
|
194
|
+
.ew-header__menu-btn[aria-expanded="true"] .ew-header__menu-icon--close { display: block; }
|
|
195
|
+
}
|
|
196
|
+
</style>
|
|
197
|
+
|
|
198
|
+
<script>
|
|
199
|
+
function initHeader(headerEl: Element) {
|
|
200
|
+
const btn = headerEl.querySelector('.ew-header__menu-btn') as HTMLButtonElement | null;
|
|
201
|
+
const nav = headerEl.querySelector('.ew-header__nav') as HTMLElement | null;
|
|
202
|
+
if (!btn || !nav) return;
|
|
203
|
+
btn.addEventListener('click', () => {
|
|
204
|
+
const isOpen = btn.getAttribute('aria-expanded') === 'true';
|
|
205
|
+
btn.setAttribute('aria-expanded', String(!isOpen));
|
|
206
|
+
isOpen ? nav.removeAttribute('data-open') : nav.setAttribute('data-open', '');
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
document.querySelectorAll('.ew-header').forEach(initHeader);
|
|
210
|
+
</script>
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
---
|
|
2
|
+
import ThemeToggle from './ThemeToggle.astro';
|
|
3
|
+
import LanguageSwitch from './LanguageSwitch.astro';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
siteName: string;
|
|
7
|
+
navItems: Array<{ label: string; href: string }>;
|
|
8
|
+
currentLang: string;
|
|
9
|
+
pathname: string;
|
|
10
|
+
alternateHref?: string;
|
|
11
|
+
menuLabel?: string;
|
|
12
|
+
/** Optional logo URL. When provided, renders an <img> in the brand area instead of site name text. */
|
|
13
|
+
logo?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const { siteName, navItems, currentLang, pathname, alternateHref, menuLabel = 'Toggle navigation menu', logo } = Astro.props;
|
|
17
|
+
const navId = `ew-header-centered-nav-${Math.random().toString(36).slice(2, 9)}`;
|
|
18
|
+
const mid = Math.ceil(navItems.length / 2);
|
|
19
|
+
const leftItems = navItems.slice(0, mid);
|
|
20
|
+
const rightItems = navItems.slice(mid);
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
<header class="ew-header-centered" data-testid="header-centered">
|
|
24
|
+
<div class="ew-header-centered__inner">
|
|
25
|
+
<nav id={navId} class="ew-header-centered__nav" aria-label="Main navigation">
|
|
26
|
+
<ul class="ew-header-centered__links ew-header-centered__links--left">
|
|
27
|
+
{leftItems.map((item) => (
|
|
28
|
+
<li>
|
|
29
|
+
<a href={item.href} class:list={['ew-header-centered__link', { 'ew-header-centered__link--active': pathname === item.href }]}>
|
|
30
|
+
{item.label}
|
|
31
|
+
</a>
|
|
32
|
+
</li>
|
|
33
|
+
))}
|
|
34
|
+
</ul>
|
|
35
|
+
|
|
36
|
+
<a href={currentLang === 'de' ? '/' : `/${currentLang}/`} class="ew-header-centered__brand">
|
|
37
|
+
{logo ? <img src={logo} alt={siteName} class="ew-header-centered__logo" /> : siteName}
|
|
38
|
+
</a>
|
|
39
|
+
|
|
40
|
+
<div class="ew-header-centered__right">
|
|
41
|
+
<ul class="ew-header-centered__links ew-header-centered__links--right">
|
|
42
|
+
{rightItems.map((item) => (
|
|
43
|
+
<li>
|
|
44
|
+
<a href={item.href} class:list={['ew-header-centered__link', { 'ew-header-centered__link--active': pathname === item.href }]}>
|
|
45
|
+
{item.label}
|
|
46
|
+
</a>
|
|
47
|
+
</li>
|
|
48
|
+
))}
|
|
49
|
+
</ul>
|
|
50
|
+
<div class="ew-header-centered__actions">
|
|
51
|
+
<slot name="actions">
|
|
52
|
+
<ThemeToggle />
|
|
53
|
+
<LanguageSwitch currentLang={currentLang} pathname={pathname} alternateHref={alternateHref} />
|
|
54
|
+
</slot>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</nav>
|
|
58
|
+
|
|
59
|
+
<button
|
|
60
|
+
type="button"
|
|
61
|
+
class="ew-header-centered__menu-btn"
|
|
62
|
+
aria-label={menuLabel}
|
|
63
|
+
aria-expanded="false"
|
|
64
|
+
aria-controls={navId}
|
|
65
|
+
data-testid="mobile-menu-toggle"
|
|
66
|
+
>
|
|
67
|
+
<svg class="ew-header-centered__menu-icon ew-header-centered__menu-icon--open" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true">
|
|
68
|
+
<line x1="3" y1="6" x2="21" y2="6"></line>
|
|
69
|
+
<line x1="3" y1="12" x2="21" y2="12"></line>
|
|
70
|
+
<line x1="3" y1="18" x2="21" y2="18"></line>
|
|
71
|
+
</svg>
|
|
72
|
+
<svg class="ew-header-centered__menu-icon ew-header-centered__menu-icon--close" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true">
|
|
73
|
+
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
74
|
+
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
75
|
+
</svg>
|
|
76
|
+
</button>
|
|
77
|
+
</div>
|
|
78
|
+
</header>
|
|
79
|
+
|
|
80
|
+
<style>
|
|
81
|
+
.ew-header-centered {
|
|
82
|
+
position: sticky;
|
|
83
|
+
top: 0;
|
|
84
|
+
z-index: 100;
|
|
85
|
+
background: var(--ew-surface);
|
|
86
|
+
border-bottom: 1px solid var(--ew-border);
|
|
87
|
+
}
|
|
88
|
+
.ew-header-centered__inner {
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
max-width: 72rem;
|
|
92
|
+
margin: 0 auto;
|
|
93
|
+
padding: var(--ew-space-3) var(--ew-space-5);
|
|
94
|
+
position: relative;
|
|
95
|
+
}
|
|
96
|
+
.ew-header-centered__nav {
|
|
97
|
+
display: flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
justify-content: space-between;
|
|
100
|
+
width: 100%;
|
|
101
|
+
gap: var(--ew-space-3);
|
|
102
|
+
}
|
|
103
|
+
.ew-header-centered__brand {
|
|
104
|
+
font-family: var(--ew-font-sans);
|
|
105
|
+
font-size: var(--ew-text-lg);
|
|
106
|
+
font-weight: 700;
|
|
107
|
+
color: var(--ew-on-surface);
|
|
108
|
+
text-decoration: none;
|
|
109
|
+
letter-spacing: -0.01em;
|
|
110
|
+
white-space: nowrap;
|
|
111
|
+
}
|
|
112
|
+
.ew-header-centered__brand:hover {
|
|
113
|
+
color: var(--ew-primary);
|
|
114
|
+
}
|
|
115
|
+
.ew-header-centered__logo {
|
|
116
|
+
height: 1.5rem;
|
|
117
|
+
width: auto;
|
|
118
|
+
display: block;
|
|
119
|
+
}
|
|
120
|
+
.ew-header-centered__links {
|
|
121
|
+
display: flex;
|
|
122
|
+
list-style: none;
|
|
123
|
+
margin: 0;
|
|
124
|
+
padding: 0;
|
|
125
|
+
gap: var(--ew-space-1);
|
|
126
|
+
}
|
|
127
|
+
.ew-header-centered__link {
|
|
128
|
+
display: block;
|
|
129
|
+
padding: var(--ew-space-2) var(--ew-space-3);
|
|
130
|
+
border-radius: var(--ew-radius-md);
|
|
131
|
+
color: var(--ew-muted);
|
|
132
|
+
font-family: var(--ew-font-sans);
|
|
133
|
+
font-size: var(--ew-text-sm);
|
|
134
|
+
font-weight: 500;
|
|
135
|
+
text-decoration: none;
|
|
136
|
+
}
|
|
137
|
+
.ew-header-centered__link:hover {
|
|
138
|
+
color: var(--ew-on-surface);
|
|
139
|
+
background: var(--ew-surface-muted);
|
|
140
|
+
}
|
|
141
|
+
.ew-header-centered__link--active {
|
|
142
|
+
color: var(--ew-on-surface);
|
|
143
|
+
background: var(--ew-surface-muted);
|
|
144
|
+
}
|
|
145
|
+
.ew-header-centered__right {
|
|
146
|
+
display: flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
gap: var(--ew-space-3);
|
|
149
|
+
}
|
|
150
|
+
.ew-header-centered__actions {
|
|
151
|
+
display: flex;
|
|
152
|
+
align-items: center;
|
|
153
|
+
gap: var(--ew-space-2);
|
|
154
|
+
border-left: 1px solid var(--ew-border);
|
|
155
|
+
padding-left: var(--ew-space-3);
|
|
156
|
+
margin-left: var(--ew-space-1);
|
|
157
|
+
}
|
|
158
|
+
.ew-header-centered__menu-btn {
|
|
159
|
+
display: none;
|
|
160
|
+
background: transparent;
|
|
161
|
+
border: none;
|
|
162
|
+
color: var(--ew-on-surface);
|
|
163
|
+
cursor: pointer;
|
|
164
|
+
padding: var(--ew-space-1);
|
|
165
|
+
position: absolute;
|
|
166
|
+
right: var(--ew-space-5);
|
|
167
|
+
top: 50%;
|
|
168
|
+
transform: translateY(-50%);
|
|
169
|
+
}
|
|
170
|
+
.ew-header-centered__menu-btn:focus-visible {
|
|
171
|
+
outline: 2px solid var(--ew-primary);
|
|
172
|
+
outline-offset: 2px;
|
|
173
|
+
}
|
|
174
|
+
.ew-header-centered__menu-icon--close { display: none; }
|
|
175
|
+
|
|
176
|
+
@media (max-width: 768px) {
|
|
177
|
+
.ew-header-centered__menu-btn {
|
|
178
|
+
display: flex;
|
|
179
|
+
}
|
|
180
|
+
.ew-header-centered__nav {
|
|
181
|
+
display: none;
|
|
182
|
+
position: absolute;
|
|
183
|
+
top: 100%;
|
|
184
|
+
left: 0;
|
|
185
|
+
right: 0;
|
|
186
|
+
flex-direction: column;
|
|
187
|
+
align-items: flex-start;
|
|
188
|
+
background: var(--ew-surface);
|
|
189
|
+
border-bottom: 1px solid var(--ew-border);
|
|
190
|
+
padding: var(--ew-space-4) var(--ew-space-5);
|
|
191
|
+
gap: var(--ew-space-4);
|
|
192
|
+
}
|
|
193
|
+
.ew-header-centered__nav[data-open] {
|
|
194
|
+
display: flex;
|
|
195
|
+
}
|
|
196
|
+
.ew-header-centered__links {
|
|
197
|
+
flex-direction: column;
|
|
198
|
+
gap: var(--ew-space-1);
|
|
199
|
+
}
|
|
200
|
+
.ew-header-centered__right {
|
|
201
|
+
flex-direction: column;
|
|
202
|
+
align-items: flex-start;
|
|
203
|
+
gap: var(--ew-space-3);
|
|
204
|
+
width: 100%;
|
|
205
|
+
}
|
|
206
|
+
.ew-header-centered__actions {
|
|
207
|
+
border-left: none;
|
|
208
|
+
padding-left: 0;
|
|
209
|
+
margin-left: 0;
|
|
210
|
+
padding-top: var(--ew-space-3);
|
|
211
|
+
border-top: 1px solid var(--ew-border);
|
|
212
|
+
width: 100%;
|
|
213
|
+
}
|
|
214
|
+
.ew-header-centered__menu-btn[aria-expanded="true"] .ew-header-centered__menu-icon--open { display: none; }
|
|
215
|
+
.ew-header-centered__menu-btn[aria-expanded="true"] .ew-header-centered__menu-icon--close { display: block; }
|
|
216
|
+
}
|
|
217
|
+
</style>
|
|
218
|
+
|
|
219
|
+
<script>
|
|
220
|
+
function initHeader(headerEl: Element) {
|
|
221
|
+
const btn = headerEl.querySelector('.ew-header-centered__menu-btn') as HTMLButtonElement | null;
|
|
222
|
+
const nav = headerEl.querySelector('.ew-header-centered__nav') as HTMLElement | null;
|
|
223
|
+
if (!btn || !nav) return;
|
|
224
|
+
btn.addEventListener('click', () => {
|
|
225
|
+
const isOpen = btn.getAttribute('aria-expanded') === 'true';
|
|
226
|
+
btn.setAttribute('aria-expanded', String(!isOpen));
|
|
227
|
+
isOpen ? nav.removeAttribute('data-open') : nav.setAttribute('data-open', '');
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
document.querySelectorAll('.ew-header-centered').forEach(initHeader);
|
|
231
|
+
</script>
|