sproutsite 0.0.0-stage → 0.5.7
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/LICENSE +202 -0
- package/NOTICE +14 -0
- package/README.md +604 -2
- package/THIRD_PARTY_NOTICES.md +85 -0
- package/VERSION +1 -0
- package/package.json +107 -5
- package/src/lib/sproutsite/colors.ts +7 -0
- package/src/lib/sproutsite/language-links.ts +60 -0
- package/src/lib/sproutsite/pages.ts +78 -0
- package/src/lib/sproutsite/rehype-ids.ts +20 -0
- package/src/lib/sproutsite/rehype-links.ts +19 -0
- package/src/lib/sproutsite/rehype-tables.ts +74 -0
- package/src/lib/sproutsite/remark-links.ts +19 -0
- package/src/lib/sproutsite/site-config.ts +110 -0
- package/src/lib/sproutsite/sitemap.ts +160 -0
- package/src/lib/sproutsite/types.ts +45 -0
- package/src/lib/sproutsite/urls.ts +79 -0
- package/src/lib/sproutsite/validation.ts +1406 -0
- package/src/package/404.astro +5 -0
- package/src/package/500.astro +5 -0
- package/src/package/components.ts +17 -0
- package/src/package/config.ts +161 -0
- package/src/package/content.ts +117 -0
- package/src/package/index.ts +3 -0
- package/src/package/manifest.ts +27 -0
- package/src/package/page.astro +124 -0
- package/src/themes/default/assets/branding/apple-touch-icon.png +0 -0
- package/src/themes/default/assets/branding/favicon-16x16.png +0 -0
- package/src/themes/default/assets/branding/favicon-32x32.png +0 -0
- package/src/themes/default/assets/branding/favicon-48x48.png +0 -0
- package/src/themes/default/assets/branding/favicon.ico +0 -0
- package/src/themes/default/assets/branding/favicon.svg +1 -0
- package/src/themes/default/assets/branding/icon-192x192.png +0 -0
- package/src/themes/default/assets/branding/icon-512x512.png +0 -0
- package/src/themes/default/assets/branding/icon-monochrome.svg +1 -0
- package/src/themes/default/assets/branding/icon.svg +18 -0
- package/src/themes/default/assets/branding/logo-dark.svg +18 -0
- package/src/themes/default/assets/branding/logo-monochrome.svg +1 -0
- package/src/themes/default/assets/branding/logo.svg +18 -0
- package/src/themes/default/assets/branding/social-card.png +0 -0
- package/src/themes/default/assets/hero-waves.svg +41 -0
- package/src/themes/default/components/atoms/Badge/Badge.astro +65 -0
- package/src/themes/default/components/atoms/Badge/Badge.css +5 -0
- package/src/themes/default/components/atoms/BrandLogo/BrandLogo.astro +26 -0
- package/src/themes/default/components/atoms/BrandLogo/BrandLogo.css +22 -0
- package/src/themes/default/components/atoms/Button/Button.astro +106 -0
- package/src/themes/default/components/atoms/Button/Button.css +14 -0
- package/src/themes/default/components/atoms/ContentImage/ContentImage.astro +54 -0
- package/src/themes/default/components/atoms/ContentImage/ContentImage.css +21 -0
- package/src/themes/default/components/atoms/Eyebrow/Eyebrow.astro +3 -0
- package/src/themes/default/components/atoms/Eyebrow/Eyebrow.css +18 -0
- package/src/themes/default/components/atoms/Icon/Icon.astro +80 -0
- package/src/themes/default/components/atoms/Icon/Icon.css +68 -0
- package/src/themes/default/components/atoms/Tab/Tab.astro +15 -0
- package/src/themes/default/components/atoms/Tab/Tab.css +34 -0
- package/src/themes/default/components/layout/Column/Column.astro +18 -0
- package/src/themes/default/components/layout/Column/Column.css +82 -0
- package/src/themes/default/components/layout/Columns/Columns.astro +163 -0
- package/src/themes/default/components/layout/Columns/Columns.css +177 -0
- package/src/themes/default/components/molecules/Accordion/Accordion.astro +17 -0
- package/src/themes/default/components/molecules/Accordion/Accordion.css +11 -0
- package/src/themes/default/components/molecules/Accordion/accordion.ts +47 -0
- package/src/themes/default/components/molecules/AccordionItem/AccordionItem.astro +100 -0
- package/src/themes/default/components/molecules/AccordionItem/AccordionItem.css +118 -0
- package/src/themes/default/components/molecules/Alert/Alert.astro +42 -0
- package/src/themes/default/components/molecules/Alert/Alert.css +13 -0
- package/src/themes/default/components/molecules/Card/Card.astro +57 -0
- package/src/themes/default/components/molecules/Card/Card.css +25 -0
- package/src/themes/default/components/molecules/CardActions/CardActions.astro +3 -0
- package/src/themes/default/components/molecules/CardActions/CardActions.css +13 -0
- package/src/themes/default/components/molecules/ContentTable/ContentTable.astro +42 -0
- package/src/themes/default/components/molecules/ContentTable/ContentTable.css +59 -0
- package/src/themes/default/components/molecules/Feature/Feature.astro +108 -0
- package/src/themes/default/components/molecules/Feature/Feature.css +157 -0
- package/src/themes/default/components/molecules/FoundationSample/FoundationSample.astro +165 -0
- package/src/themes/default/components/molecules/FoundationSample/FoundationSample.css +201 -0
- package/src/themes/default/components/molecules/LanguageSwitcher/LanguageSwitcher.astro +118 -0
- package/src/themes/default/components/molecules/LanguageSwitcher/LanguageSwitcher.css +134 -0
- package/src/themes/default/components/molecules/Tabs/Tabs.astro +33 -0
- package/src/themes/default/components/molecules/Tabs/Tabs.css +38 -0
- package/src/themes/default/components/molecules/Tabs/tabs.ts +91 -0
- package/src/themes/default/components/organisms/BlogIndex/BlogIndex.astro +86 -0
- package/src/themes/default/components/organisms/BlogIndex/BlogIndex.css +17 -0
- package/src/themes/default/components/organisms/BlogPost/BlogPost.astro +51 -0
- package/src/themes/default/components/organisms/BlogPost/BlogPost.css +5 -0
- package/src/themes/default/components/organisms/Footer/Footer.astro +57 -0
- package/src/themes/default/components/organisms/Footer/Footer.css +63 -0
- package/src/themes/default/components/organisms/Header/Header.astro +223 -0
- package/src/themes/default/components/organisms/Header/Header.css +282 -0
- package/src/themes/default/components/organisms/Hero/Hero.astro +106 -0
- package/src/themes/default/components/organisms/Hero/Hero.css +187 -0
- package/src/themes/default/components/organisms/PageTitle/PageTitle.astro +39 -0
- package/src/themes/default/components/organisms/PageTitle/PageTitle.css +25 -0
- package/src/themes/default/components/organisms/Section/Section.astro +39 -0
- package/src/themes/default/components/organisms/Section/Section.css +21 -0
- package/src/themes/default/i18n/de.yaml +38 -0
- package/src/themes/default/i18n/en.yaml +38 -0
- package/src/themes/default/i18n/index.ts +63 -0
- package/src/themes/default/layouts/ErrorPage/ErrorPage.astro +110 -0
- package/src/themes/default/layouts/PageLayout/PageLayout.astro +108 -0
- package/src/themes/default/layouts/PageLayout/PageLayout.css +15 -0
- package/src/themes/default/styles/foundation/base.css +19 -0
- package/src/themes/default/styles/foundation/focus.css +6 -0
- package/src/themes/default/styles/foundation/fonts/OFL.txt +93 -0
- package/src/themes/default/styles/foundation/fonts/nunito-latin-variable.woff2 +0 -0
- package/src/themes/default/styles/foundation/fonts.css +17 -0
- package/src/themes/default/styles/foundation/layout.css +6 -0
- package/src/themes/default/styles/foundation/prose.css +54 -0
- package/src/themes/default/styles/foundation/tokens.css +48 -0
- package/src/themes/default/styles/theme.css +99 -0
- package/src/themes/default/styles/themes/section-tones.css +30 -0
- package/third-party-licenses/daisyui-LICENSE +21 -0
- package/third-party-licenses/flag-icons-LICENSE +21 -0
- package/third-party-licenses/lucide-LICENSE +43 -0
- package/third-party-licenses/tailwindcss-LICENSE +21 -0
- package/third-party-licenses/tailwindcss-typography-LICENSE +21 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/** Enhance readable static panels into independently keyboard-operable tabs. */
|
|
2
|
+
export function initializeTabs(root: ParentNode = document): void {
|
|
3
|
+
for (const group of root.querySelectorAll<HTMLElement>('.ss-tabs')) {
|
|
4
|
+
if (group.dataset.enhanced) continue;
|
|
5
|
+
const list = group.querySelector<HTMLElement>(
|
|
6
|
+
':scope > .ss-tabs__list',
|
|
7
|
+
);
|
|
8
|
+
const panels = Array.from(
|
|
9
|
+
group.querySelectorAll<HTMLElement>(':scope > .ss-tab'),
|
|
10
|
+
);
|
|
11
|
+
if (!list || panels.length === 0) continue;
|
|
12
|
+
const initial = Number(group.dataset.initial) - 1;
|
|
13
|
+
if (
|
|
14
|
+
!Number.isInteger(initial) ||
|
|
15
|
+
initial < 0 ||
|
|
16
|
+
initial >= panels.length
|
|
17
|
+
)
|
|
18
|
+
throw new Error('Tabs initial exceeds the number of Tab panels.');
|
|
19
|
+
|
|
20
|
+
let sequence = 1;
|
|
21
|
+
while (document.getElementById(`ss-tabs-${sequence}`)) sequence += 1;
|
|
22
|
+
group.id = `ss-tabs-${sequence}`;
|
|
23
|
+
list.setAttribute('role', 'tablist');
|
|
24
|
+
list.setAttribute('aria-label', list.dataset.label ?? 'Tabs');
|
|
25
|
+
|
|
26
|
+
const buttons = panels.map((panel, index) => {
|
|
27
|
+
const button = document.createElement('button');
|
|
28
|
+
button.type = 'button';
|
|
29
|
+
button.className = 'ss-tabs__button tab';
|
|
30
|
+
button.id = `${group.id}-tab-${index + 1}`;
|
|
31
|
+
button.textContent = panel.dataset.title ?? '';
|
|
32
|
+
button.setAttribute('role', 'tab');
|
|
33
|
+
panel.id = `${group.id}-panel-${index + 1}`;
|
|
34
|
+
panel.setAttribute('role', 'tabpanel');
|
|
35
|
+
panel.setAttribute('aria-labelledby', button.id);
|
|
36
|
+
panel.tabIndex = 0;
|
|
37
|
+
button.setAttribute('aria-controls', panel.id);
|
|
38
|
+
const label = panel.querySelector<HTMLElement>(
|
|
39
|
+
':scope > .ss-tab__label',
|
|
40
|
+
);
|
|
41
|
+
if (label) label.hidden = true;
|
|
42
|
+
list.append(button);
|
|
43
|
+
return button;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
function activate(selected: number): void {
|
|
47
|
+
buttons.forEach((button, index) => {
|
|
48
|
+
const active = index === selected;
|
|
49
|
+
button.setAttribute('aria-selected', String(active));
|
|
50
|
+
button.tabIndex = active ? 0 : -1;
|
|
51
|
+
button.classList.toggle('tab-active', active);
|
|
52
|
+
panels[index].hidden = !active;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
buttons.forEach((button, index) => {
|
|
57
|
+
button.addEventListener('click', () => activate(index));
|
|
58
|
+
button.addEventListener('focus', () => activate(index));
|
|
59
|
+
button.addEventListener('keydown', (event) => {
|
|
60
|
+
let next: number;
|
|
61
|
+
switch (event.key) {
|
|
62
|
+
case 'ArrowRight':
|
|
63
|
+
next = (index + 1) % buttons.length;
|
|
64
|
+
break;
|
|
65
|
+
case 'ArrowLeft':
|
|
66
|
+
next = (index - 1 + buttons.length) % buttons.length;
|
|
67
|
+
break;
|
|
68
|
+
case 'Home':
|
|
69
|
+
next = 0;
|
|
70
|
+
break;
|
|
71
|
+
case 'End':
|
|
72
|
+
next = buttons.length - 1;
|
|
73
|
+
break;
|
|
74
|
+
default:
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
buttons[next].focus();
|
|
79
|
+
buttons[next].scrollIntoView({
|
|
80
|
+
block: 'nearest',
|
|
81
|
+
inline: 'nearest',
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
activate(initial);
|
|
86
|
+
list.hidden = false;
|
|
87
|
+
group.dataset.enhanced = 'true';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
initializeTabs();
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { CollectionEntry } from 'astro:content';
|
|
3
|
+
import {
|
|
4
|
+
blogRouteFromId,
|
|
5
|
+
contentHref,
|
|
6
|
+
} from '../../../../../lib/sproutsite/urls.js';
|
|
7
|
+
import type { SiteConfig } from '../../../../../lib/sproutsite/types.js';
|
|
8
|
+
import PageLayout from '../../../layouts/PageLayout/PageLayout.astro';
|
|
9
|
+
import { t } from '../../../i18n/index.js';
|
|
10
|
+
import Card from '../../molecules/Card/Card.astro';
|
|
11
|
+
import CardActions from '../../molecules/CardActions/CardActions.astro';
|
|
12
|
+
import PageTitle from '../PageTitle/PageTitle.astro';
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
posts: CollectionEntry<'blogPages'>[];
|
|
16
|
+
site: SiteConfig;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const { posts, site } = Astro.props;
|
|
20
|
+
const locale = site.language === 'de' ? 'de' : 'en';
|
|
21
|
+
const blog = site.blog ?? {
|
|
22
|
+
title: 'Blog',
|
|
23
|
+
description: t(locale, 'blogDescription'),
|
|
24
|
+
eyebrow: t(locale, 'blogEyebrow'),
|
|
25
|
+
heading: t(locale, 'blogHeading'),
|
|
26
|
+
};
|
|
27
|
+
const dateFormatter = new Intl.DateTimeFormat(site.language, {
|
|
28
|
+
day: '2-digit',
|
|
29
|
+
month: 'long',
|
|
30
|
+
year: 'numeric',
|
|
31
|
+
timeZone: 'UTC',
|
|
32
|
+
});
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
<PageLayout
|
|
36
|
+
site={site}
|
|
37
|
+
title={blog.title}
|
|
38
|
+
description={blog.description}
|
|
39
|
+
route="/blog/"
|
|
40
|
+
>
|
|
41
|
+
<PageTitle
|
|
42
|
+
title={blog.title}
|
|
43
|
+
eyebrow={blog.eyebrow}
|
|
44
|
+
description={blog.description}
|
|
45
|
+
classes={site.heroClasses}
|
|
46
|
+
variant="hero"
|
|
47
|
+
/>
|
|
48
|
+
<section
|
|
49
|
+
class="tone-default ss-section ss-blog-index"
|
|
50
|
+
aria-labelledby="blog-overview"
|
|
51
|
+
>
|
|
52
|
+
<div class="ss-section__inner site-shell">
|
|
53
|
+
<div class="content-prose ss-blog-index__content">
|
|
54
|
+
<h2 id="blog-overview">{blog.heading}</h2>
|
|
55
|
+
<div class="ss-blog-index__grid">
|
|
56
|
+
{posts.map((post) => (
|
|
57
|
+
<Card
|
|
58
|
+
image={post.data.image}
|
|
59
|
+
imageAlt={post.data.imageAlt}
|
|
60
|
+
>
|
|
61
|
+
<time
|
|
62
|
+
class="ss-blog-index__date"
|
|
63
|
+
datetime={post.data.pubDate.toISOString()}
|
|
64
|
+
>
|
|
65
|
+
{dateFormatter.format(post.data.pubDate)}
|
|
66
|
+
</time>
|
|
67
|
+
<h2 class="card-title">{post.data.title}</h2>
|
|
68
|
+
<p>{post.data.description}</p>
|
|
69
|
+
<CardActions>
|
|
70
|
+
<a
|
|
71
|
+
aria-label={`${t(locale, 'readMore')}: ${post.data.title}`}
|
|
72
|
+
href={contentHref(
|
|
73
|
+
blogRouteFromId(post.id),
|
|
74
|
+
site,
|
|
75
|
+
)}
|
|
76
|
+
>
|
|
77
|
+
{t(locale, 'readMore')}
|
|
78
|
+
</a>
|
|
79
|
+
</CardActions>
|
|
80
|
+
</Card>
|
|
81
|
+
))}
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</section>
|
|
86
|
+
</PageLayout>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ss-blog-index {
|
|
3
|
+
.ss-blog-index__content {
|
|
4
|
+
.ss-blog-index__grid {
|
|
5
|
+
@apply mt-8 grid gap-6 md:grid-cols-2;
|
|
6
|
+
|
|
7
|
+
.ss-card {
|
|
8
|
+
@apply my-0 h-full;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.ss-blog-index__date {
|
|
13
|
+
@apply text-sm font-semibold tracking-wide text-base-content/70 uppercase;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { CollectionEntry } from 'astro:content';
|
|
3
|
+
import type { AssembledPage } from '../../../../../lib/sproutsite/pages.js';
|
|
4
|
+
import type { SiteConfig } from '../../../../../lib/sproutsite/types.js';
|
|
5
|
+
import PageLayout from '../../../layouts/PageLayout/PageLayout.astro';
|
|
6
|
+
import Hero from '../Hero/Hero.astro';
|
|
7
|
+
import Section from '../Section/Section.astro';
|
|
8
|
+
|
|
9
|
+
type BlogPage = CollectionEntry<'blogPages'>;
|
|
10
|
+
type BlogDocument = CollectionEntry<'blogDocuments'>;
|
|
11
|
+
type RenderedContent = Awaited<
|
|
12
|
+
ReturnType<typeof import('astro:content').render>
|
|
13
|
+
>['Content'];
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
post: AssembledPage<BlogPage, BlogDocument>;
|
|
17
|
+
site: SiteConfig;
|
|
18
|
+
HeroContent: RenderedContent;
|
|
19
|
+
sections: { section: BlogDocument; Content: RenderedContent }[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const { post, site, HeroContent, sections } = Astro.props;
|
|
23
|
+
const dateFormatter = new Intl.DateTimeFormat(site.language, {
|
|
24
|
+
day: '2-digit',
|
|
25
|
+
month: 'long',
|
|
26
|
+
year: 'numeric',
|
|
27
|
+
timeZone: 'UTC',
|
|
28
|
+
});
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<PageLayout
|
|
32
|
+
site={site}
|
|
33
|
+
title={post.entry.data.title}
|
|
34
|
+
description={post.entry.data.description}
|
|
35
|
+
route={post.route}
|
|
36
|
+
>
|
|
37
|
+
<div class="ss-blog-post">
|
|
38
|
+
<Hero hero={post.hero!} site={site} Content={HeroContent}>
|
|
39
|
+
<time
|
|
40
|
+
slot="meta"
|
|
41
|
+
class="ss-hero__meta"
|
|
42
|
+
datetime={post.entry.data.pubDate.toISOString()}
|
|
43
|
+
>
|
|
44
|
+
{dateFormatter.format(post.entry.data.pubDate)}
|
|
45
|
+
</time>
|
|
46
|
+
</Hero>
|
|
47
|
+
{sections.map(({ section, Content }) => (
|
|
48
|
+
<Section section={section} Content={Content} />
|
|
49
|
+
))}
|
|
50
|
+
</div>
|
|
51
|
+
</PageLayout>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
import BrandLogo from '../../atoms/BrandLogo/BrandLogo.astro';
|
|
3
|
+
import version from '../../../../../../VERSION?raw';
|
|
4
|
+
import { t } from '../../../i18n/index.js';
|
|
5
|
+
import type { SiteConfig } from '../../../../../lib/sproutsite/types.js';
|
|
6
|
+
import {
|
|
7
|
+
contentHref,
|
|
8
|
+
isExternalWebLink,
|
|
9
|
+
} from '../../../../../lib/sproutsite/urls.js';
|
|
10
|
+
interface Props {
|
|
11
|
+
site: SiteConfig;
|
|
12
|
+
}
|
|
13
|
+
const { site } = Astro.props;
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
<footer class="ss-footer">
|
|
17
|
+
<div class="ss-footer__inner site-shell">
|
|
18
|
+
<div class="ss-footer__text">
|
|
19
|
+
<div class="ss-footer__brand">
|
|
20
|
+
<a
|
|
21
|
+
href={contentHref('/', site)}
|
|
22
|
+
aria-label={`${site.name}: ${t(site.language === 'de' ? 'de' : 'en', 'home')}`}
|
|
23
|
+
>
|
|
24
|
+
<BrandLogo name={site.name} />
|
|
25
|
+
</a>
|
|
26
|
+
<span class="ss-footer__version">Version {version.trim()}</span>
|
|
27
|
+
</div>
|
|
28
|
+
<span>{site.footer.text}</span>
|
|
29
|
+
</div>
|
|
30
|
+
<nav
|
|
31
|
+
aria-label={t(
|
|
32
|
+
site.language === 'de' ? 'de' : 'en',
|
|
33
|
+
'footerNavigation',
|
|
34
|
+
)}
|
|
35
|
+
>
|
|
36
|
+
<ul class="ss-footer__links">
|
|
37
|
+
{site.footer.links.map((link, index) => {
|
|
38
|
+
const external = isExternalWebLink(link.href, site.url);
|
|
39
|
+
return (
|
|
40
|
+
<li>
|
|
41
|
+
{index > 0 && <span aria-hidden="true">·</span>}
|
|
42
|
+
<a
|
|
43
|
+
href={contentHref(link.href, site)}
|
|
44
|
+
target={external ? '_blank' : undefined}
|
|
45
|
+
rel={
|
|
46
|
+
external ? 'noopener noreferrer' : undefined
|
|
47
|
+
}
|
|
48
|
+
>
|
|
49
|
+
{link.label}
|
|
50
|
+
</a>
|
|
51
|
+
</li>
|
|
52
|
+
);
|
|
53
|
+
})}
|
|
54
|
+
</ul>
|
|
55
|
+
</nav>
|
|
56
|
+
</div>
|
|
57
|
+
</footer>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ss-footer {
|
|
3
|
+
@apply border-t text-primary-content;
|
|
4
|
+
border-color: color-mix(
|
|
5
|
+
in srgb,
|
|
6
|
+
var(--color-hero-ocean) 55%,
|
|
7
|
+
var(--color-hero-navy)
|
|
8
|
+
);
|
|
9
|
+
background-color: var(--color-hero-navy);
|
|
10
|
+
background-image:
|
|
11
|
+
radial-gradient(
|
|
12
|
+
ellipse at 88% 100%,
|
|
13
|
+
color-mix(in srgb, var(--color-hero-ocean) 32%, transparent),
|
|
14
|
+
transparent 65%
|
|
15
|
+
),
|
|
16
|
+
linear-gradient(
|
|
17
|
+
110deg,
|
|
18
|
+
var(--color-hero-navy) 32%,
|
|
19
|
+
var(--color-hero-midnight)
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
.ss-footer__inner {
|
|
23
|
+
@apply flex flex-wrap items-center justify-between gap-x-4 gap-y-8 py-10 text-sm;
|
|
24
|
+
|
|
25
|
+
.ss-footer__text {
|
|
26
|
+
@apply flex flex-wrap items-center gap-x-6 gap-y-8;
|
|
27
|
+
|
|
28
|
+
.ss-footer__brand {
|
|
29
|
+
position: relative;
|
|
30
|
+
|
|
31
|
+
> a {
|
|
32
|
+
display: block;
|
|
33
|
+
color: var(--color-primary-content);
|
|
34
|
+
text-decoration: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.ss-footer__version {
|
|
38
|
+
@apply whitespace-nowrap text-xs;
|
|
39
|
+
position: absolute;
|
|
40
|
+
top: calc(100% + 0.375rem);
|
|
41
|
+
left: 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ss-footer__links {
|
|
47
|
+
@apply flex flex-wrap gap-2;
|
|
48
|
+
|
|
49
|
+
li {
|
|
50
|
+
@apply inline-flex items-center gap-2;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
a {
|
|
54
|
+
color: var(--color-primary-content);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
a:focus-visible {
|
|
59
|
+
outline-color: var(--color-hero-green);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
---
|
|
2
|
+
import BrandLogo from '../../atoms/BrandLogo/BrandLogo.astro';
|
|
3
|
+
import Button from '../../atoms/Button/Button.astro';
|
|
4
|
+
import Icon from '../../atoms/Icon/Icon.astro';
|
|
5
|
+
import LanguageSwitcher from '../../molecules/LanguageSwitcher/LanguageSwitcher.astro';
|
|
6
|
+
import type { ComponentProps } from 'astro/types';
|
|
7
|
+
import { t } from '../../../i18n/index.js';
|
|
8
|
+
import type { Link, SiteConfig } from '../../../../../lib/sproutsite/types.js';
|
|
9
|
+
import {
|
|
10
|
+
contentHref,
|
|
11
|
+
isExternalWebLink,
|
|
12
|
+
} from '../../../../../lib/sproutsite/urls.js';
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
site: SiteConfig;
|
|
16
|
+
route: string;
|
|
17
|
+
}
|
|
18
|
+
const { site, route } = Astro.props;
|
|
19
|
+
const isActive = (link: Link) => link.href === route;
|
|
20
|
+
const language = site.language === 'de' ? 'de' : 'en';
|
|
21
|
+
const hasLanguageSwitcher = site.header.links.some(
|
|
22
|
+
(link) => link.type === 'language-switcher',
|
|
23
|
+
);
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
<header class="ss-header">
|
|
27
|
+
<div class="ss-header__inner site-shell">
|
|
28
|
+
<a class="ss-header__brand" href={contentHref('/', site)}>
|
|
29
|
+
<BrandLogo name={site.name} />
|
|
30
|
+
</a>
|
|
31
|
+
<div class="ss-header__mobile-tools">
|
|
32
|
+
{hasLanguageSwitcher && (
|
|
33
|
+
<>
|
|
34
|
+
<LanguageSwitcher site={site} route={route} />
|
|
35
|
+
<span
|
|
36
|
+
class="ss-header__mobile-divider"
|
|
37
|
+
aria-hidden="true"
|
|
38
|
+
/>
|
|
39
|
+
</>
|
|
40
|
+
)}
|
|
41
|
+
<button
|
|
42
|
+
type="button"
|
|
43
|
+
class="ss-header__menu-toggle"
|
|
44
|
+
aria-label={t(language, 'openMenu')}
|
|
45
|
+
aria-controls="ss-mobile-menu"
|
|
46
|
+
aria-expanded="false"
|
|
47
|
+
>
|
|
48
|
+
<Icon name="Menu" size={28} />
|
|
49
|
+
</button>
|
|
50
|
+
</div>
|
|
51
|
+
<nav
|
|
52
|
+
class="ss-header__nav"
|
|
53
|
+
aria-label={t(
|
|
54
|
+
site.language === 'de' ? 'de' : 'en',
|
|
55
|
+
'primaryNavigation',
|
|
56
|
+
)}
|
|
57
|
+
>
|
|
58
|
+
<ul class="ss-header__links">
|
|
59
|
+
{site.header.links.map((link) => {
|
|
60
|
+
if (link.type === 'language-switcher') {
|
|
61
|
+
return (
|
|
62
|
+
<li>
|
|
63
|
+
<LanguageSwitcher site={site} route={route} />
|
|
64
|
+
</li>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
if (link.type === 'separator') {
|
|
68
|
+
return (
|
|
69
|
+
<li
|
|
70
|
+
class="ss-header__separator"
|
|
71
|
+
aria-hidden="true"
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
const external = isExternalWebLink(link.href, site.url);
|
|
76
|
+
// Icon validates configured names against Lucide at render time.
|
|
77
|
+
const icon = link.icon as
|
|
78
|
+
ComponentProps<typeof Icon>['name'] | undefined;
|
|
79
|
+
if (link.type === 'cta') {
|
|
80
|
+
return (
|
|
81
|
+
<li class="ss-header__cta">
|
|
82
|
+
<Button
|
|
83
|
+
href={link.href}
|
|
84
|
+
variant={link.variant}
|
|
85
|
+
size="md"
|
|
86
|
+
target={external ? '_blank' : undefined}
|
|
87
|
+
rel={
|
|
88
|
+
external
|
|
89
|
+
? 'noopener noreferrer'
|
|
90
|
+
: undefined
|
|
91
|
+
}
|
|
92
|
+
aria-current={
|
|
93
|
+
isActive(link) ? 'page' : undefined
|
|
94
|
+
}
|
|
95
|
+
>
|
|
96
|
+
{icon && <Icon name={icon} size={20} />}
|
|
97
|
+
{link.label}
|
|
98
|
+
</Button>
|
|
99
|
+
</li>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
return (
|
|
103
|
+
<li>
|
|
104
|
+
<a
|
|
105
|
+
class="ss-header__link btn btn-ghost btn-sm"
|
|
106
|
+
href={contentHref(link.href, site)}
|
|
107
|
+
target={external ? '_blank' : undefined}
|
|
108
|
+
rel={
|
|
109
|
+
external ? 'noopener noreferrer' : undefined
|
|
110
|
+
}
|
|
111
|
+
aria-current={
|
|
112
|
+
isActive(link) ? 'page' : undefined
|
|
113
|
+
}
|
|
114
|
+
>
|
|
115
|
+
{icon && <Icon name={icon} size={20} />}
|
|
116
|
+
{link.label}
|
|
117
|
+
</a>
|
|
118
|
+
</li>
|
|
119
|
+
);
|
|
120
|
+
})}
|
|
121
|
+
</ul>
|
|
122
|
+
</nav>
|
|
123
|
+
</div>
|
|
124
|
+
<dialog
|
|
125
|
+
id="ss-mobile-menu"
|
|
126
|
+
class="ss-header__dialog"
|
|
127
|
+
aria-label={t(language, 'primaryNavigation')}
|
|
128
|
+
>
|
|
129
|
+
<div class="ss-header__dialog-top site-shell">
|
|
130
|
+
<a class="ss-header__dialog-brand" href={contentHref('/', site)}>
|
|
131
|
+
<BrandLogo name={site.name} />
|
|
132
|
+
</a>
|
|
133
|
+
<button
|
|
134
|
+
type="button"
|
|
135
|
+
class="ss-header__dialog-close"
|
|
136
|
+
aria-label={t(language, 'closeMenu')}
|
|
137
|
+
autofocus
|
|
138
|
+
>
|
|
139
|
+
<Icon name="X" size={32} />
|
|
140
|
+
</button>
|
|
141
|
+
</div>
|
|
142
|
+
<div class="ss-header__dialog-content site-shell" />
|
|
143
|
+
</dialog>
|
|
144
|
+
</header>
|
|
145
|
+
|
|
146
|
+
<script>
|
|
147
|
+
const scrollThreshold = 6;
|
|
148
|
+
const header = document.querySelector<HTMLElement>('.ss-header');
|
|
149
|
+
|
|
150
|
+
if (header) {
|
|
151
|
+
const navigation = header.querySelector<HTMLElement>('.ss-header__nav');
|
|
152
|
+
const dialog =
|
|
153
|
+
header.querySelector<HTMLDialogElement>('.ss-header__dialog');
|
|
154
|
+
const dialogContent = header.querySelector<HTMLElement>(
|
|
155
|
+
'.ss-header__dialog-content',
|
|
156
|
+
);
|
|
157
|
+
const toggle = header.querySelector<HTMLButtonElement>(
|
|
158
|
+
'.ss-header__menu-toggle',
|
|
159
|
+
);
|
|
160
|
+
const close = header.querySelector<HTMLButtonElement>(
|
|
161
|
+
'.ss-header__dialog-close',
|
|
162
|
+
);
|
|
163
|
+
if (navigation && dialog && dialogContent && toggle && close) {
|
|
164
|
+
const home = navigation.parentElement!;
|
|
165
|
+
const mobile = window.matchMedia('(max-width: 71.999rem)');
|
|
166
|
+
let previousOverflow = '';
|
|
167
|
+
const closeLanguageMenus = () =>
|
|
168
|
+
header
|
|
169
|
+
.querySelectorAll<HTMLDetailsElement>(
|
|
170
|
+
'.ss-language-switcher',
|
|
171
|
+
)
|
|
172
|
+
.forEach((menu) => {
|
|
173
|
+
menu.open = false;
|
|
174
|
+
});
|
|
175
|
+
const syncNavigation = () => {
|
|
176
|
+
if (dialog.open) dialog.close();
|
|
177
|
+
closeLanguageMenus();
|
|
178
|
+
(mobile.matches ? dialogContent : home).append(navigation);
|
|
179
|
+
};
|
|
180
|
+
toggle.addEventListener('click', () => {
|
|
181
|
+
if (!mobile.matches || dialog.open) return;
|
|
182
|
+
closeLanguageMenus();
|
|
183
|
+
previousOverflow = document.documentElement.style.overflow;
|
|
184
|
+
dialog.showModal();
|
|
185
|
+
document.documentElement.style.overflow = 'hidden';
|
|
186
|
+
toggle.setAttribute('aria-expanded', 'true');
|
|
187
|
+
});
|
|
188
|
+
close.addEventListener('click', () => dialog.close());
|
|
189
|
+
dialog.addEventListener('close', () => {
|
|
190
|
+
document.documentElement.style.overflow = previousOverflow;
|
|
191
|
+
toggle.setAttribute('aria-expanded', 'false');
|
|
192
|
+
closeLanguageMenus();
|
|
193
|
+
if (mobile.matches) toggle.focus();
|
|
194
|
+
else
|
|
195
|
+
header
|
|
196
|
+
.querySelector<HTMLAnchorElement>('.ss-header__brand')
|
|
197
|
+
?.focus({ preventScroll: true });
|
|
198
|
+
});
|
|
199
|
+
navigation.addEventListener('click', (event) => {
|
|
200
|
+
if (
|
|
201
|
+
event.target instanceof Element &&
|
|
202
|
+
event.target.closest('a') &&
|
|
203
|
+
dialog.open
|
|
204
|
+
)
|
|
205
|
+
dialog.close();
|
|
206
|
+
});
|
|
207
|
+
mobile.addEventListener('change', syncNavigation);
|
|
208
|
+
header.dataset.mobileEnhanced = '';
|
|
209
|
+
syncNavigation();
|
|
210
|
+
}
|
|
211
|
+
const updateHeaderState = () => {
|
|
212
|
+
header.classList.toggle(
|
|
213
|
+
'ss-header--scrolled',
|
|
214
|
+
window.scrollY >= scrollThreshold,
|
|
215
|
+
);
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
updateHeaderState();
|
|
219
|
+
window.addEventListener('scroll', updateHeaderState, {
|
|
220
|
+
passive: true,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
</script>
|