@easy-web/content-blocks 1.0.0 → 1.2.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 CHANGED
@@ -1,332 +1,332 @@
1
- # @easy-web/content-blocks
2
-
3
- Reusable Astro content-block components for the IT-CI ismaili.de web ecosystem. Twenty-two pure-Astro components covering page chrome (Header, Footer, ThemeToggle, LanguageSwitch), hero/CTA/contact sections, cards and grids, a CMS-driven gallery system with six variants, blog post cards, legal-page layouts, banners, and styled prose. All components use the `--ew-*` design tokens from `@easy-web/theme-core`; no styling system of their own.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- pnpm add @easy-web/content-blocks
9
- ```
10
-
11
- This package is published to npm. Install it like any other npm package.
12
-
13
- ### Peer dependencies
14
-
15
- * `astro >= 6.0.0`
16
-
17
- You almost certainly also want `@easy-web/theme-core` (for the `--ew-*` token CSS) and, if you build a bilingual site, `@easy-web/i18n` (for the alternate-link helper used by `LanguageSwitch`).
18
-
19
- ## Import convention
20
-
21
- Components ship as **raw `.astro` files**. There is no JavaScript barrel. Import each component from its component path:
22
-
23
- ```astro
24
- ---
25
- import Header from '@easy-web/content-blocks/components/Header';
26
- import Footer from '@easy-web/content-blocks/components/Footer';
27
- import Hero from '@easy-web/content-blocks/components/Hero';
28
- import Section from '@easy-web/content-blocks/components/Section';
29
- import CardGrid from '@easy-web/content-blocks/components/CardGrid';
30
- import Card from '@easy-web/content-blocks/components/Card';
31
- ---
32
- ```
33
-
34
- The package's `package.json` exports map declares `./components/*` → `./src/components/*.astro`, so Astro consumes the source files directly — no build step is involved on the package side for the components themselves.
35
-
36
- ## Quick start
37
-
38
- ### Layout — wire Header and Footer into your base layout
39
-
40
- ```astro
41
- ---
42
- // src/layouts/Base.astro
43
- import '@easy-web/theme-core/tokens.css';
44
- import { noFlashScript } from '@easy-web/theme-core';
45
- import Header from '@easy-web/content-blocks/components/Header';
46
- import Footer from '@easy-web/content-blocks/components/Footer';
47
- import { siteConfig } from '../config';
48
-
49
- interface Props {
50
- lang: string;
51
- title: string;
52
- pathname: string;
53
- alternateHref?: string;
54
- }
55
- const { lang, title, pathname, alternateHref } = Astro.props;
56
- const navItems = siteConfig.navItems[lang];
57
- const legalLinks = siteConfig.legalLinks[lang];
58
- ---
59
- <html lang={lang}>
60
- <head>
61
- <script is:inline set:html={noFlashScript}></script>
62
- <title>{title}</title>
63
- </head>
64
- <body>
65
- <Header
66
- siteName={siteConfig.siteName}
67
- navItems={navItems}
68
- currentLang={lang}
69
- pathname={pathname}
70
- alternateHref={alternateHref}
71
- />
72
- <slot />
73
- <Footer siteName={siteConfig.siteName} legalLinks={legalLinks} />
74
- </body>
75
- </html>
76
- ```
77
-
78
- ### Page — compose Hero + Section + CardGrid + Card
79
-
80
- ```astro
81
- ---
82
- // src/pages/index.astro
83
- import Layout from '../layouts/Base.astro';
84
- import Hero from '@easy-web/content-blocks/components/Hero';
85
- import Section from '@easy-web/content-blocks/components/Section';
86
- import CardGrid from '@easy-web/content-blocks/components/CardGrid';
87
- import Card from '@easy-web/content-blocks/components/Card';
88
- ---
89
- <Layout lang="de" title="Home" pathname="/">
90
- <Hero
91
- title="Willkommen"
92
- subtitle="Untertitel mit Beschreibung"
93
- ctaLabel="Mehr erfahren"
94
- ctaHref="#about"
95
- />
96
- <Section id="about">
97
- <h2>Über uns</h2>
98
- <p>Inhalt …</p>
99
- </Section>
100
- <Section>
101
- <CardGrid>
102
- <Card title="Erste Karte" description="Kurze Beschreibung" href="/a" />
103
- <Card title="Zweite Karte" description="Kurze Beschreibung" href="/b" />
104
- <Card title="Dritte Karte" description="Kurze Beschreibung" href="/c" />
105
- </CardGrid>
106
- </Section>
107
- </Layout>
108
- ```
109
-
110
- ## Component reference
111
-
112
- All components use the `--ew-*` design tokens from `@easy-web/theme-core`. None ship their own theme system; they inherit whatever tokens are loaded in the consuming page.
113
-
114
- ### Site chrome
115
-
116
- | Component | Required props | Optional props | Notes |
117
- | :--- | :--- | :--- | :--- |
118
- | `Header` | `siteName: string`, `navItems: NavItem[]`, `currentLang: string`, `pathname: string` | `alternateHref?: string`, `menuLabel?: string` | Sticky responsive header with `actions` slot. Mobile hamburger menu (scoped vanilla JS). Default slot fallback renders `ThemeToggle` + `LanguageSwitch`. `data-testid="header-classic"`. |
119
- | `HeaderCentered` | `siteName: string`, `navItems: NavItem[]`, `currentLang: string`, `pathname: string` | `alternateHref?: string`, `menuLabel?: string` | Variant: brand centered, nav links split left/right. Same `actions` slot and mobile hamburger. `data-testid="header-centered"`. |
120
- | `HeaderHideOnScroll` | `siteName: string`, `navItems: NavItem[]`, `currentLang: string`, `pathname: string` | `alternateHref?: string`, `menuLabel?: string` | Variant: `position: fixed` header that slides off screen on scroll-down, reappears on scroll-up. Compensates body padding via JS. `data-testid="header-hide-on-scroll"`. |
121
- | `HeaderFlyout` | `siteName: string`, `navItems: NavItem[]`, `currentLang: string`, `pathname: string` | `alternateHref?: string`, `menuLabel?: string` | Variant: items with `children[]` show a flyout dropdown (hover/focus desktop, click mobile, keyboard accessible). `data-testid="header-flyout"`. |
122
- | `Footer` | `siteName: string`, `legalLinks: Array<{ label: string; href: string }>` | — | Simple copyright + legal-link footer. |
123
- | `ThemeToggle` | — | — | Light / dark / system trio button. Talks to `@easy-web/theme-core` via `data-theme` on `<html>` and `localStorage`. |
124
- | `LanguageSwitch` | `currentLang: string`, `pathname: string` | `alternateHref?: string` | DE ↔ EN switcher. If `alternateHref` is provided, links there directly; otherwise infers the alternate path from `pathname`. |
125
-
126
- #### Header `actions` slot
127
-
128
- All four header variants expose a named `actions` slot. When the slot receives content, it replaces the default `ThemeToggle` + `LanguageSwitch` controls. When the slot is empty, the fallback renders those controls unchanged (backward compatible).
129
-
130
- ```astro
131
- ---
132
- import Header from '@easy-web/content-blocks/components/Header';
133
- import HeaderCentered from '@easy-web/content-blocks/components/HeaderCentered';
134
- import HeaderHideOnScroll from '@easy-web/content-blocks/components/HeaderHideOnScroll';
135
- import HeaderFlyout from '@easy-web/content-blocks/components/HeaderFlyout';
136
- ---
137
-
138
- <!-- Default: ThemeToggle + LanguageSwitch rendered automatically -->
139
- <Header siteName="My Site" navItems={navItems} currentLang="de" pathname={pathname} />
140
-
141
- <!-- Custom slot content replaces ThemeToggle + LanguageSwitch -->
142
- <HeaderCentered siteName="My Site" navItems={navItems} currentLang="de" pathname={pathname}>
143
- <fragment slot="actions">
144
- <MyCustomButton />
145
- </fragment>
146
- </HeaderCentered>
147
-
148
- <!-- Flyout: navItems may include children[] for dropdown panels -->
149
- <HeaderFlyout siteName="My Site" navItems={navItemsWithChildren} currentLang="de" pathname={pathname} />
150
- ```
151
-
152
- Selecting the header variant in a Base layout via a `headerVariant` prop:
153
-
154
- ```astro
155
- ---
156
- // Base.astro
157
- import Header from '@easy-web/content-blocks/components/Header';
158
- import HeaderCentered from '@easy-web/content-blocks/components/HeaderCentered';
159
- import HeaderHideOnScroll from '@easy-web/content-blocks/components/HeaderHideOnScroll';
160
- import HeaderFlyout from '@easy-web/content-blocks/components/HeaderFlyout';
161
-
162
- interface Props {
163
- headerVariant?: 'classic' | 'centered' | 'hide-on-scroll' | 'flyout';
164
- // …other props
165
- }
166
- const { headerVariant = 'classic' } = Astro.props;
167
- const HeaderComponents = { classic: Header, centered: HeaderCentered, 'hide-on-scroll': HeaderHideOnScroll, flyout: HeaderFlyout };
168
- const ActiveHeader = HeaderComponents[headerVariant];
169
- ---
170
- <ActiveHeader siteName={siteName} navItems={navItems} currentLang={lang} pathname={pathname} alternateHref={alternateHref} />
171
- ```
172
-
173
- ### Hero / call-to-action / contact
174
-
175
- | Component | Required props | Optional props | Notes |
176
- | :--- | :--- | :--- | :--- |
177
- | `Hero` | `title: string` | `subtitle?: string`, `ctaLabel?: string`, `ctaHref?: string`, `variant?: 'centered' \| 'left-aligned'` | Page banner with optional CTA. CTA renders only when both `ctaLabel` and `ctaHref` are present. |
178
- | `CtaSection` | `heading: string`, `buttonLabel: string`, `buttonHref: string` | `body?: string`, `variant?: 'default' \| 'muted' \| 'primary'` | Standalone CTA banner. `primary` variant inverts colors to brand. |
179
- | `ContactSection` | `heading: string`, `email: string`, `buttonLabel: string` | `body?: string` | Centered mailto-only contact CTA. Button is `mailto:${email}`. |
180
-
181
- ### Structural
182
-
183
- | Component | Required props | Optional props | Notes |
184
- | :--- | :--- | :--- | :--- |
185
- | `Section` | — | `id?: string`, `class?: string` | Generic content wrapper. `id` enables anchor-link targets. Slot-based. |
186
- | `CardGrid` | — | — | Responsive CSS grid (3 → 2 → 1 columns by breakpoint). Slot in `Card`s. |
187
- | `Card` | `title: string` | `description?: string`, `href?: string`, `image?: string`, `imageAlt?: string` | Content card. Renders as `<a>` when `href` is provided, plain `<div>` otherwise. Image is `loading="lazy"`. |
188
-
189
- ### Gallery system
190
-
191
- The gallery system is **CMS-driven**: content authors create gallery entries in their site's `src/content/galleries/` directory; pages decide which entry to load and where to place it. Each entry has a `kind` field that selects the rendering variant.
192
-
193
- Six variants are available:
194
-
195
- | `kind` | Component | Use case |
196
- | :--- | :--- | :--- |
197
- | `image-grid` | `GalleryImageGrid` | Static N-column uniform grid. Component previews, team photos, sponsors. |
198
- | `hero-slider` | `GalleryHeroSlider` | Full-bleed editorial carousel with title + subtitle + optional CTA per slide. |
199
- | `carousel` | `GalleryCarousel` | Image slider with optional captions. Constrained-width container; no per-slide CTA. |
200
- | `masonry-grid` | `GalleryMasonryGrid` | Pinterest-style variable-height grid via CSS columns. Photography, portfolios. |
201
- | `feature-highlight` | `GalleryFeatureHighlight` | Alternating image+text+link rows. Product feature showcase, service descriptions. |
202
- | `lightbox-grid` | `GalleryLightboxGrid` | Uniform grid + click-to-expand modal. Photo albums, event galleries. Vanilla JS modal with keyboard navigation. |
203
-
204
- Schema is exported from this package and consumed by each instance's `content.config.ts`:
205
-
206
- ```ts
207
- import { defineCollection } from 'astro:content';
208
- import { glob } from 'astro/loaders';
209
- import { gallerySchema } from '@easy-web/content-blocks/schemas/galleries';
210
-
211
- const galleries = defineCollection({
212
- loader: glob({ pattern: '**/*.{yml,yaml}', base: './src/content/galleries' }),
213
- schema: gallerySchema,
214
- });
215
- ```
216
-
217
- Use the `GallerySection` dispatcher in pages — it switches on `entry.data.kind` and renders the right variant:
218
-
219
- ```astro
220
- ---
221
- import GallerySection from '@easy-web/content-blocks/components/GallerySection';
222
- import { getEntry } from 'astro:content';
223
-
224
- const heroEntry = await getEntry('galleries', 'home-hero-de');
225
- const previewEntry = await getEntry('galleries', 'about-component-preview-de');
226
- ---
227
- <GallerySection entry={heroEntry} />
228
- <!-- ...other page content... -->
229
- <GallerySection entry={previewEntry} />
230
- ```
231
-
232
- | Component | Required props | Optional props | Notes |
233
- | :--- | :--- | :--- | :--- |
234
- | `GallerySection` | `entry: { data: GalleryEntry }` | — | Dispatcher. Renders the correct variant based on `entry.data.kind`. Renders nothing when `entry` is null/undefined. |
235
- | `GalleryImageGrid` | `items: GalleryImageGridData['items']` | `title?`, `columns?: 2 \| 3 \| 4 \| 6`, `gap?: 'sm' \| 'md' \| 'lg'`, `aspectRatio?: 'square' \| '4/3' \| '16/9' \| 'auto'` | Pure CSS grid (responsive). Item `href` wraps in `<a>`. Item `caption` renders as `<figcaption>`. |
236
- | `GalleryHeroSlider` | `slides: GalleryHeroSliderData['slides']` | `title?`, `autoplay?: boolean`, `interval?: number` (ms), `height?: 'sm' \| 'md' \| 'lg' \| 'full'` | Vanilla JS slider. Pause on hover/focus, keyboard arrows, dot navigation, respects `prefers-reduced-motion`. |
237
- | `GalleryCarousel` | `slides: GalleryCarouselData['slides']` | `title?`, `autoplay?: boolean` (default `false`), `interval?: number`, `showDots?: boolean`, `showArrows?: boolean` | Constrained-width slider with optional per-slide caption (overlay at bottom). Same JS controls as `GalleryHeroSlider`. |
238
- | `GalleryMasonryGrid` | `items: GalleryMasonryGridData['items']` | `title?`, `columns?: 2 \| 3 \| 4`, `gap?: 'sm' \| 'md' \| 'lg'` | Pure CSS columns; no JS. `break-inside: avoid` keeps items intact. Falls back to fewer columns on smaller breakpoints. |
239
- | `GalleryFeatureHighlight` | `items: GalleryFeatureHighlightData['items']` | `title?`, `gap?: 'sm' \| 'md' \| 'lg'` | Alternating image-left / image-right rows; per-item `imagePosition` overrides the alternation. Stacks on mobile (image first). |
240
- | `GalleryLightboxGrid` | `items: GalleryLightboxGridData['items']` | `title?`, `columns?: 2 \| 3 \| 4`, `gap?: 'sm' \| 'md' \| 'lg'`, `aspectRatio?: 'square' \| '4/3' \| 'auto'` | Grid + modal lightbox. Click image to expand; keyboard `Esc`/arrows navigate; backdrop click closes; restores focus to trigger on close. Body scroll locked while open. |
241
-
242
- ### Blog
243
-
244
- | Component | Required props | Optional props | Notes |
245
- | :--- | :--- | :--- | :--- |
246
- | `BlogPostCard` | `title: string`, `description: string`, `href: string`, `pubDate: Date` | `heroImage?: string`, `heroImageAlt?: string`, `locale?: string` | Linked card for blog index pages. Date is `Intl.DateTimeFormat`-formatted with the provided `locale`. |
247
-
248
- ### Legal & long-form
249
-
250
- | Component | Required props | Optional props | Notes |
251
- | :--- | :--- | :--- | :--- |
252
- | `LegalLayout` | — | (slot-based) | Narrow content wrapper for impressum / datenschutz / AGB. Constrains line-length for legal prose. |
253
- | `Prose` | — | (slot-based) | Styled wrapper for Markdown/HTML content (`<h1>`–`<h6>`, `<p>`, `<ul>`, `<a>`, `<blockquote>`, `<code>`, etc.) using `--ew-*` typography tokens. |
254
-
255
- ### Banners / notices
256
-
257
- | Component | Required props | Optional props | Notes |
258
- | :--- | :--- | :--- | :--- |
259
- | `DraftBanner` | — | (slot-based, expects a short message) | Banner notice for draft content. |
260
- | `LanguageNotice` | — | (slot-based, expects a translation-status message) | Banner notice when a page is shown in the non-current locale or has a partial translation. |
261
-
262
- ## <UniversalMedia>
263
-
264
- A universal image dispatcher component that renders images from any source type consistently.
265
-
266
- ### Props
267
-
268
- | Prop | Type | Required | Description |
269
- |------|------|----------|-------------|
270
- | `src` | `ImageMetadata \| string` | ✓ | Image source: resolved metadata or a URL/path string |
271
- | `alt` | `string` | ✓ | Alt text |
272
- | `images` | `Record<string, () => Promise<{ default: ImageMetadata }>>` | ✓ | Consumer-supplied glob result (pass `import.meta.glob(...)` from the calling component) |
273
- | `fallbackSrc` | `string` | — | Fallback image path when `/src/assets/` glob lookup fails |
274
- | `fallbackAlt` | `string` | — | Fallback alt text (defaults to `alt`) |
275
- | `width` | `number` | — | Image width in px (default: 800) |
276
- | `height` | `number` | — | Image height in px (default: 600) |
277
- | `class` | `string` | — | CSS class name |
278
- | `decoding` | `'async' \| 'auto' \| 'sync'` | — | Image decoding hint (default: `'async'`) |
279
-
280
- ### Dispatch logic
281
-
282
- 1. **`ImageMetadata` object** → `<Image>` (Astro-optimised, generates srcset)
283
- 2. **`/src/assets/...` string** → glob lookup via `images` prop → `<Image>` (or fallback/plain `<img>` on miss)
284
- 3. **`http://...` / `https://...` string** → `<Image inferSize>` (reads dimensions from remote)
285
- 4. **Everything else** (e.g., `/public/...` paths) → plain `<img>`
286
-
287
- > **Unsupported formats**: HEIC and JXL. Reject these at the CMS upload level (e.g., Decap CMS widget `hint`).
288
-
289
- ### Usage
290
-
291
- ```astro
292
- ---
293
- import type { ImageMetadata } from 'astro';
294
- import UniversalMedia from '@easy-web/content-blocks/components/UniversalMedia';
295
-
296
- const images = import.meta.glob<{ default: ImageMetadata }>('/src/assets/**', { import: 'default' });
297
- ---
298
-
299
- <UniversalMedia
300
- src={entry.data.photo}
301
- alt={entry.data.photoAlt}
302
- {images}
303
- fallbackSrc="/src/assets/images/default.png"
304
- fallbackAlt="Default image"
305
- />
306
- ```
307
-
308
- ## Styling
309
-
310
- All components reference the `@easy-web/theme-core` CSS custom properties:
311
-
312
- * Colors: `--ew-surface`, `--ew-on-surface`, `--ew-surface-muted`, `--ew-primary`, `--ew-on-primary`, `--ew-border`, `--ew-muted`
313
- * Typography: `--ew-font-sans`, `--ew-text-{xs,sm,base,lg,xl,2xl,3xl}`, `--ew-leading-{tight,normal,loose}`
314
- * Spacing: `--ew-space-{0..12}`
315
- * Radii: `--ew-radius-{sm,md,lg,xl,full}`
316
-
317
- To re-skin a site, override these custom properties on a parent element (or globally on `:root`) — do not edit the components.
318
-
319
- Components use BEM-style class names prefixed with `ew-` (e.g., `.ew-hero`, `.ew-hero__title`, `.ew-hero--centered`). Selectors are intentionally specific enough to be styled via standard CSS overrides without `!important`.
320
-
321
- ## Adoption status
322
-
323
- The [package adoption matrix](https://github.com/achimismaili/websites/blob/main/docs/architecture/package-adoption.md) tracks which sites consume which version of this package. As of 2026-06-10:
324
-
325
- * `dev.ismaili.de` (pilot) — `^0.2.0`
326
- * `harleyrentflorida.de` (customer) — `^0.1.0` (one minor behind; bump pending while `/preview` is paused)
327
-
328
- ## See also
329
-
330
- * [`@easy-web/theme-core`](https://github.com/achimismaili/easy-web/blob/main/packages/theme-core/README.md) — the design-token package these components consume.
331
- * [`@easy-web/i18n`](https://github.com/achimismaili/easy-web/blob/main/packages/i18n/README.md) — Astro + Paraglide bilingual utilities used together with `LanguageSwitch`.
332
- * [`easy-web/AGENTS.md`](https://github.com/achimismaili/easy-web/blob/main/AGENTS.md) — repo orientation and publishing workflow.
1
+ # @easy-web/content-blocks
2
+
3
+ Reusable Astro content-block components for the IT-CI ismaili.de web ecosystem. Twenty-two pure-Astro components covering page chrome (Header, Footer, ThemeToggle, LanguageSwitch), hero/CTA/contact sections, cards and grids, a CMS-driven gallery system with six variants, blog post cards, legal-page layouts, banners, and styled prose. All components use the `--ew-*` design tokens from `@easy-web/theme-core`; no styling system of their own.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @easy-web/content-blocks
9
+ ```
10
+
11
+ This package is published to npm. Install it like any other npm package.
12
+
13
+ ### Peer dependencies
14
+
15
+ * `astro >= 6.0.0 < 8.0.0`
16
+ * `zod >= 4.0.0`
17
+
18
+ `@easy-web/theme-core` (the `--ew-*` token CSS) and `@easy-web/i18n` (the alternate-link helper behind `LanguageSwitch` and the locale utilities behind `NotFound`) are regular **dependencies** of this package, so your package manager installs them for you. They used to be peer dependencies; they were promoted because changesets escalates peer-dependents to a major bump, which together with the `fixed` version group made minor releases impossible. Both are pure functions and CSS tokens with no shared runtime state, so a duplicate copy costs bundle size, not correctness. `@easy-web/auth` is deliberately excluded from that promotion — its MSAL single-instance requirement is real.
19
+
20
+ ## Import convention
21
+
22
+ Components ship as **raw `.astro` files**. There is no JavaScript barrel. Import each component from its component path:
23
+
24
+ ```astro
25
+ ---
26
+ import Header from '@easy-web/content-blocks/components/Header';
27
+ import Footer from '@easy-web/content-blocks/components/Footer';
28
+ import Hero from '@easy-web/content-blocks/components/Hero';
29
+ import Section from '@easy-web/content-blocks/components/Section';
30
+ import CardGrid from '@easy-web/content-blocks/components/CardGrid';
31
+ import Card from '@easy-web/content-blocks/components/Card';
32
+ ---
33
+ ```
34
+
35
+ The package's `package.json` exports map declares `./components/*` → `./src/components/*.astro`, so Astro consumes the source files directly — no build step is involved on the package side for the components themselves.
36
+
37
+ ## Quick start
38
+
39
+ ### Layout — wire Header and Footer into your base layout
40
+
41
+ ```astro
42
+ ---
43
+ // src/layouts/Base.astro
44
+ import '@easy-web/theme-core/tokens.css';
45
+ import { noFlashScript } from '@easy-web/theme-core';
46
+ import Header from '@easy-web/content-blocks/components/Header';
47
+ import Footer from '@easy-web/content-blocks/components/Footer';
48
+ import { siteConfig } from '../config';
49
+
50
+ interface Props {
51
+ lang: string;
52
+ title: string;
53
+ pathname: string;
54
+ alternateHref?: string;
55
+ }
56
+ const { lang, title, pathname, alternateHref } = Astro.props;
57
+ const navItems = siteConfig.navItems[lang];
58
+ const legalLinks = siteConfig.legalLinks[lang];
59
+ ---
60
+ <html lang={lang}>
61
+ <head>
62
+ <script is:inline set:html={noFlashScript}></script>
63
+ <title>{title}</title>
64
+ </head>
65
+ <body>
66
+ <Header
67
+ siteName={siteConfig.siteName}
68
+ navItems={navItems}
69
+ currentLang={lang}
70
+ pathname={pathname}
71
+ alternateHref={alternateHref}
72
+ />
73
+ <slot />
74
+ <Footer siteName={siteConfig.siteName} legalLinks={legalLinks} />
75
+ </body>
76
+ </html>
77
+ ```
78
+
79
+ ### Page — compose Hero + Section + CardGrid + Card
80
+
81
+ ```astro
82
+ ---
83
+ // src/pages/index.astro
84
+ import Layout from '../layouts/Base.astro';
85
+ import Hero from '@easy-web/content-blocks/components/Hero';
86
+ import Section from '@easy-web/content-blocks/components/Section';
87
+ import CardGrid from '@easy-web/content-blocks/components/CardGrid';
88
+ import Card from '@easy-web/content-blocks/components/Card';
89
+ ---
90
+ <Layout lang="de" title="Home" pathname="/">
91
+ <Hero
92
+ title="Willkommen"
93
+ subtitle="Untertitel mit Beschreibung"
94
+ ctaLabel="Mehr erfahren"
95
+ ctaHref="#about"
96
+ />
97
+ <Section id="about">
98
+ <h2>Über uns</h2>
99
+ <p>Inhalt …</p>
100
+ </Section>
101
+ <Section>
102
+ <CardGrid>
103
+ <Card title="Erste Karte" description="Kurze Beschreibung" href="/a" />
104
+ <Card title="Zweite Karte" description="Kurze Beschreibung" href="/b" />
105
+ <Card title="Dritte Karte" description="Kurze Beschreibung" href="/c" />
106
+ </CardGrid>
107
+ </Section>
108
+ </Layout>
109
+ ```
110
+
111
+ ## Component reference
112
+
113
+ All components use the `--ew-*` design tokens from `@easy-web/theme-core`. None ship their own theme system; they inherit whatever tokens are loaded in the consuming page.
114
+
115
+ ### Site chrome
116
+
117
+ | Component | Required props | Optional props | Notes |
118
+ | :--- | :--- | :--- | :--- |
119
+ | `Header` | `siteName: string`, `navItems: NavItem[]`, `currentLang: string`, `pathname: string` | `alternateHref?: string`, `menuLabel?: string` | Sticky responsive header with `actions` slot. Mobile hamburger menu (scoped vanilla JS). Default slot fallback renders `ThemeToggle` + `LanguageSwitch`. `data-testid="header-classic"`. |
120
+ | `HeaderCentered` | `siteName: string`, `navItems: NavItem[]`, `currentLang: string`, `pathname: string` | `alternateHref?: string`, `menuLabel?: string` | Variant: brand centered, nav links split left/right. Same `actions` slot and mobile hamburger. `data-testid="header-centered"`. |
121
+ | `HeaderHideOnScroll` | `siteName: string`, `navItems: NavItem[]`, `currentLang: string`, `pathname: string` | `alternateHref?: string`, `menuLabel?: string` | Variant: `position: fixed` header that slides off screen on scroll-down, reappears on scroll-up. Compensates body padding via JS. `data-testid="header-hide-on-scroll"`. |
122
+ | `HeaderFlyout` | `siteName: string`, `navItems: NavItem[]`, `currentLang: string`, `pathname: string` | `alternateHref?: string`, `menuLabel?: string` | Variant: items with `children[]` show a flyout dropdown (hover/focus desktop, click mobile, keyboard accessible). `data-testid="header-flyout"`. |
123
+ | `Footer` | `siteName: string`, `legalLinks: Array<{ label: string; href: string }>` | — | Simple copyright + legal-link footer. |
124
+ | `ThemeToggle` | — | — | Light / dark / system trio button. Talks to `@easy-web/theme-core` via `data-theme` on `<html>` and `localStorage`. |
125
+ | `LanguageSwitch` | `currentLang: string`, `pathname: string` | `alternateHref?: string` | DE ↔ EN switcher. If `alternateHref` is provided, links there directly; otherwise infers the alternate path from `pathname`. |
126
+
127
+ #### Header `actions` slot
128
+
129
+ All four header variants expose a named `actions` slot. When the slot receives content, it replaces the default `ThemeToggle` + `LanguageSwitch` controls. When the slot is empty, the fallback renders those controls unchanged (backward compatible).
130
+
131
+ ```astro
132
+ ---
133
+ import Header from '@easy-web/content-blocks/components/Header';
134
+ import HeaderCentered from '@easy-web/content-blocks/components/HeaderCentered';
135
+ import HeaderHideOnScroll from '@easy-web/content-blocks/components/HeaderHideOnScroll';
136
+ import HeaderFlyout from '@easy-web/content-blocks/components/HeaderFlyout';
137
+ ---
138
+
139
+ <!-- Default: ThemeToggle + LanguageSwitch rendered automatically -->
140
+ <Header siteName="My Site" navItems={navItems} currentLang="de" pathname={pathname} />
141
+
142
+ <!-- Custom slot content replaces ThemeToggle + LanguageSwitch -->
143
+ <HeaderCentered siteName="My Site" navItems={navItems} currentLang="de" pathname={pathname}>
144
+ <fragment slot="actions">
145
+ <MyCustomButton />
146
+ </fragment>
147
+ </HeaderCentered>
148
+
149
+ <!-- Flyout: navItems may include children[] for dropdown panels -->
150
+ <HeaderFlyout siteName="My Site" navItems={navItemsWithChildren} currentLang="de" pathname={pathname} />
151
+ ```
152
+
153
+ Selecting the header variant in a Base layout via a `headerVariant` prop:
154
+
155
+ ```astro
156
+ ---
157
+ // Base.astro
158
+ import Header from '@easy-web/content-blocks/components/Header';
159
+ import HeaderCentered from '@easy-web/content-blocks/components/HeaderCentered';
160
+ import HeaderHideOnScroll from '@easy-web/content-blocks/components/HeaderHideOnScroll';
161
+ import HeaderFlyout from '@easy-web/content-blocks/components/HeaderFlyout';
162
+
163
+ interface Props {
164
+ headerVariant?: 'classic' | 'centered' | 'hide-on-scroll' | 'flyout';
165
+ // …other props
166
+ }
167
+ const { headerVariant = 'classic' } = Astro.props;
168
+ const HeaderComponents = { classic: Header, centered: HeaderCentered, 'hide-on-scroll': HeaderHideOnScroll, flyout: HeaderFlyout };
169
+ const ActiveHeader = HeaderComponents[headerVariant];
170
+ ---
171
+ <ActiveHeader siteName={siteName} navItems={navItems} currentLang={lang} pathname={pathname} alternateHref={alternateHref} />
172
+ ```
173
+
174
+ ### Hero / call-to-action / contact
175
+
176
+ | Component | Required props | Optional props | Notes |
177
+ | :--- | :--- | :--- | :--- |
178
+ | `Hero` | `title: string` | `subtitle?: string`, `ctaLabel?: string`, `ctaHref?: string`, `variant?: 'centered' \| 'left-aligned'` | Page banner with optional CTA. CTA renders only when both `ctaLabel` and `ctaHref` are present. |
179
+ | `CtaSection` | `heading: string`, `buttonLabel: string`, `buttonHref: string` | `body?: string`, `variant?: 'default' \| 'muted' \| 'primary'` | Standalone CTA banner. `primary` variant inverts colors to brand. |
180
+ | `ContactSection` | `heading: string`, `email: string`, `buttonLabel: string` | `body?: string` | Centered mailto-only contact CTA. Button is `mailto:${email}`. |
181
+
182
+ ### Structural
183
+
184
+ | Component | Required props | Optional props | Notes |
185
+ | :--- | :--- | :--- | :--- |
186
+ | `Section` | — | `id?: string`, `class?: string` | Generic content wrapper. `id` enables anchor-link targets. Slot-based. |
187
+ | `CardGrid` | — | — | Responsive CSS grid (3 → 2 → 1 columns by breakpoint). Slot in `Card`s. |
188
+ | `Card` | `title: string` | `description?: string`, `href?: string`, `image?: string`, `imageAlt?: string` | Content card. Renders as `<a>` when `href` is provided, plain `<div>` otherwise. Image is `loading="lazy"`. |
189
+
190
+ ### Gallery system
191
+
192
+ The gallery system is **CMS-driven**: content authors create gallery entries in their site's `src/content/galleries/` directory; pages decide which entry to load and where to place it. Each entry has a `kind` field that selects the rendering variant.
193
+
194
+ Six variants are available:
195
+
196
+ | `kind` | Component | Use case |
197
+ | :--- | :--- | :--- |
198
+ | `image-grid` | `GalleryImageGrid` | Static N-column uniform grid. Component previews, team photos, sponsors. |
199
+ | `hero-slider` | `GalleryHeroSlider` | Full-bleed editorial carousel with title + subtitle + optional CTA per slide. |
200
+ | `carousel` | `GalleryCarousel` | Image slider with optional captions. Constrained-width container; no per-slide CTA. |
201
+ | `masonry-grid` | `GalleryMasonryGrid` | Pinterest-style variable-height grid via CSS columns. Photography, portfolios. |
202
+ | `feature-highlight` | `GalleryFeatureHighlight` | Alternating image+text+link rows. Product feature showcase, service descriptions. |
203
+ | `lightbox-grid` | `GalleryLightboxGrid` | Uniform grid + click-to-expand modal. Photo albums, event galleries. Vanilla JS modal with keyboard navigation. |
204
+
205
+ Schema is exported from this package and consumed by each instance's `content.config.ts`:
206
+
207
+ ```ts
208
+ import { defineCollection } from 'astro:content';
209
+ import { glob } from 'astro/loaders';
210
+ import { gallerySchema } from '@easy-web/content-blocks/schemas/galleries';
211
+
212
+ const galleries = defineCollection({
213
+ loader: glob({ pattern: '**/*.{yml,yaml}', base: './src/content/galleries' }),
214
+ schema: gallerySchema,
215
+ });
216
+ ```
217
+
218
+ Use the `GallerySection` dispatcher in pages — it switches on `entry.data.kind` and renders the right variant:
219
+
220
+ ```astro
221
+ ---
222
+ import GallerySection from '@easy-web/content-blocks/components/GallerySection';
223
+ import { getEntry } from 'astro:content';
224
+
225
+ const heroEntry = await getEntry('galleries', 'home-hero-de');
226
+ const previewEntry = await getEntry('galleries', 'about-component-preview-de');
227
+ ---
228
+ <GallerySection entry={heroEntry} />
229
+ <!-- ...other page content... -->
230
+ <GallerySection entry={previewEntry} />
231
+ ```
232
+
233
+ | Component | Required props | Optional props | Notes |
234
+ | :--- | :--- | :--- | :--- |
235
+ | `GallerySection` | `entry: { data: GalleryEntry }` | — | Dispatcher. Renders the correct variant based on `entry.data.kind`. Renders nothing when `entry` is null/undefined. |
236
+ | `GalleryImageGrid` | `items: GalleryImageGridData['items']` | `title?`, `columns?: 2 \| 3 \| 4 \| 6`, `gap?: 'sm' \| 'md' \| 'lg'`, `aspectRatio?: 'square' \| '4/3' \| '16/9' \| 'auto'` | Pure CSS grid (responsive). Item `href` wraps in `<a>`. Item `caption` renders as `<figcaption>`. |
237
+ | `GalleryHeroSlider` | `slides: GalleryHeroSliderData['slides']` | `title?`, `autoplay?: boolean`, `interval?: number` (ms), `height?: 'sm' \| 'md' \| 'lg' \| 'full'` | Vanilla JS slider. Pause on hover/focus, keyboard arrows, dot navigation, respects `prefers-reduced-motion`. |
238
+ | `GalleryCarousel` | `slides: GalleryCarouselData['slides']` | `title?`, `autoplay?: boolean` (default `false`), `interval?: number`, `showDots?: boolean`, `showArrows?: boolean` | Constrained-width slider with optional per-slide caption (overlay at bottom). Same JS controls as `GalleryHeroSlider`. |
239
+ | `GalleryMasonryGrid` | `items: GalleryMasonryGridData['items']` | `title?`, `columns?: 2 \| 3 \| 4`, `gap?: 'sm' \| 'md' \| 'lg'` | Pure CSS columns; no JS. `break-inside: avoid` keeps items intact. Falls back to fewer columns on smaller breakpoints. |
240
+ | `GalleryFeatureHighlight` | `items: GalleryFeatureHighlightData['items']` | `title?`, `gap?: 'sm' \| 'md' \| 'lg'` | Alternating image-left / image-right rows; per-item `imagePosition` overrides the alternation. Stacks on mobile (image first). |
241
+ | `GalleryLightboxGrid` | `items: GalleryLightboxGridData['items']` | `title?`, `columns?: 2 \| 3 \| 4`, `gap?: 'sm' \| 'md' \| 'lg'`, `aspectRatio?: 'square' \| '4/3' \| 'auto'` | Grid + modal lightbox. Click image to expand; keyboard `Esc`/arrows navigate; backdrop click closes; restores focus to trigger on close. Body scroll locked while open. |
242
+
243
+ ### Blog
244
+
245
+ | Component | Required props | Optional props | Notes |
246
+ | :--- | :--- | :--- | :--- |
247
+ | `BlogPostCard` | `title: string`, `description: string`, `href: string`, `pubDate: Date` | `heroImage?: string`, `heroImageAlt?: string`, `locale?: string` | Linked card for blog index pages. Date is `Intl.DateTimeFormat`-formatted with the provided `locale`. |
248
+
249
+ ### Legal & long-form
250
+
251
+ | Component | Required props | Optional props | Notes |
252
+ | :--- | :--- | :--- | :--- |
253
+ | `LegalLayout` | — | (slot-based) | Narrow content wrapper for impressum / datenschutz / AGB. Constrains line-length for legal prose. |
254
+ | `Prose` | — | (slot-based) | Styled wrapper for Markdown/HTML content (`<h1>`–`<h6>`, `<p>`, `<ul>`, `<a>`, `<blockquote>`, `<code>`, etc.) using `--ew-*` typography tokens. |
255
+
256
+ ### Banners / notices
257
+
258
+ | Component | Required props | Optional props | Notes |
259
+ | :--- | :--- | :--- | :--- |
260
+ | `DraftBanner` | — | (slot-based, expects a short message) | Banner notice for draft content. |
261
+ | `LanguageNotice` | — | (slot-based, expects a translation-status message) | Banner notice when a page is shown in the non-current locale or has a partial translation. |
262
+
263
+ ## <UniversalMedia>
264
+
265
+ A universal image dispatcher component that renders images from any source type consistently.
266
+
267
+ ### Props
268
+
269
+ | Prop | Type | Required | Description |
270
+ |------|------|----------|-------------|
271
+ | `src` | `ImageMetadata \| string` | ✓ | Image source: resolved metadata or a URL/path string |
272
+ | `alt` | `string` | ✓ | Alt text |
273
+ | `images` | `Record<string, () => Promise<{ default: ImageMetadata }>>` | ✓ | Consumer-supplied glob result (pass `import.meta.glob(...)` from the calling component) |
274
+ | `fallbackSrc` | `string` | — | Fallback image path when `/src/assets/` glob lookup fails |
275
+ | `fallbackAlt` | `string` | — | Fallback alt text (defaults to `alt`) |
276
+ | `width` | `number` | — | Image width in px (default: 800) |
277
+ | `height` | `number` | — | Image height in px (default: 600) |
278
+ | `class` | `string` | — | CSS class name |
279
+ | `decoding` | `'async' \| 'auto' \| 'sync'` | — | Image decoding hint (default: `'async'`) |
280
+
281
+ ### Dispatch logic
282
+
283
+ 1. **`ImageMetadata` object** → `<Image>` (Astro-optimised, generates srcset)
284
+ 2. **`/src/assets/...` string** → glob lookup via `images` prop → `<Image>` (or fallback/plain `<img>` on miss)
285
+ 3. **`http://...` / `https://...` string** → `<Image inferSize>` (reads dimensions from remote)
286
+ 4. **Everything else** (e.g., `/public/...` paths) → plain `<img>`
287
+
288
+ > **Unsupported formats**: HEIC and JXL. Reject these at the CMS upload level (e.g., Decap CMS widget `hint`).
289
+
290
+ ### Usage
291
+
292
+ ```astro
293
+ ---
294
+ import type { ImageMetadata } from 'astro';
295
+ import UniversalMedia from '@easy-web/content-blocks/components/UniversalMedia';
296
+
297
+ const images = import.meta.glob<{ default: ImageMetadata }>('/src/assets/**', { import: 'default' });
298
+ ---
299
+
300
+ <UniversalMedia
301
+ src={entry.data.photo}
302
+ alt={entry.data.photoAlt}
303
+ {images}
304
+ fallbackSrc="/src/assets/images/default.png"
305
+ fallbackAlt="Default image"
306
+ />
307
+ ```
308
+
309
+ ## Styling
310
+
311
+ All components reference the `@easy-web/theme-core` CSS custom properties:
312
+
313
+ * Colors: `--ew-surface`, `--ew-on-surface`, `--ew-surface-muted`, `--ew-primary`, `--ew-on-primary`, `--ew-border`, `--ew-muted`
314
+ * Typography: `--ew-font-sans`, `--ew-text-{xs,sm,base,lg,xl,2xl,3xl}`, `--ew-leading-{tight,normal,loose}`
315
+ * Spacing: `--ew-space-{0..12}`
316
+ * Radii: `--ew-radius-{sm,md,lg,xl,full}`
317
+
318
+ To re-skin a site, override these custom properties on a parent element (or globally on `:root`) — do not edit the components.
319
+
320
+ Components use BEM-style class names prefixed with `ew-` (e.g., `.ew-hero`, `.ew-hero__title`, `.ew-hero--centered`). Selectors are intentionally specific enough to be styled via standard CSS overrides without `!important`.
321
+
322
+ ## Adoption status
323
+
324
+ The published version is `1.1.0`. Both active instances — `dev.ismaili.de` (pilot) and `harleyrentflorida.de` (customer) — consume this package at `^1.1.0`.
325
+
326
+ The [package adoption matrix](https://dev.azure.com/it-ci/websites/_git/websites?path=/docs/architecture/package-adoption.md) in the `websites` meta-repo is the canonical per-instance record.
327
+
328
+ ## See also
329
+
330
+ * [`@easy-web/theme-core`](https://github.com/achimismaili/easy-web/blob/main/packages/theme-core/README.md) — the design-token package these components consume.
331
+ * [`@easy-web/i18n`](https://github.com/achimismaili/easy-web/blob/main/packages/i18n/README.md) — Astro + Paraglide bilingual utilities used together with `LanguageSwitch`.
332
+ * [`easy-web/AGENTS.md`](https://github.com/achimismaili/easy-web/blob/main/AGENTS.md) — repo orientation and publishing workflow.