maverick-wave-astro 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 +83 -0
- package/bin/check.mjs +53 -0
- package/components/Accordion.astro +47 -0
- package/components/Address.astro +36 -0
- package/components/Announcement.astro +27 -0
- package/components/Avatar.astro +34 -0
- package/components/BaseLayout.astro +142 -0
- package/components/BlogPost.astro +144 -0
- package/components/Breadcrumbs.astro +69 -0
- package/components/Calendar.astro +104 -0
- package/components/CalendarLegend.astro +34 -0
- package/components/ComingSoon.astro +21 -0
- package/components/DateStamp.astro +24 -0
- package/components/EmptyState.astro +24 -0
- package/components/Favicons.astro +42 -0
- package/components/Feed.astro +85 -0
- package/components/Footer.astro +162 -0
- package/components/Gallery.astro +55 -0
- package/components/Header.astro +107 -0
- package/components/Hero.astro +158 -0
- package/components/Icon.astro +27 -0
- package/components/IconCard.astro +36 -0
- package/components/ImageSlider.astro +64 -0
- package/components/ImprintCard.astro +52 -0
- package/components/JsonLd.astro +11 -0
- package/components/LanguageSwitch.astro +53 -0
- package/components/LegalPage.astro +19 -0
- package/components/Media.astro +40 -0
- package/components/MetaInfo.astro +24 -0
- package/components/Modal.astro +47 -0
- package/components/Mosaic.astro +38 -0
- package/components/NotFound.astro +34 -0
- package/components/Offer.astro +79 -0
- package/components/OpeningHours.astro +14 -0
- package/components/PageHeader.astro +38 -0
- package/components/Picture.astro +50 -0
- package/components/PortraitGallery.astro +68 -0
- package/components/PostalAddress.astro +20 -0
- package/components/Price.astro +84 -0
- package/components/PrivacyCard.astro +65 -0
- package/components/Progress.astro +53 -0
- package/components/PromoBar.astro +25 -0
- package/components/Schedule.astro +60 -0
- package/components/SectionHead.astro +18 -0
- package/components/SocialLinks.astro +47 -0
- package/components/Stepper.astro +76 -0
- package/components/Stories.astro +80 -0
- package/components/TabPanel.astro +15 -0
- package/components/Table.astro +115 -0
- package/components/Tabs.astro +38 -0
- package/components/Testimonial.astro +61 -0
- package/components/ThemeToggle.astro +30 -0
- package/components/Tiles.astro +63 -0
- package/components/Timeline.astro +64 -0
- package/components/ValueList.astro +42 -0
- package/config/eslint.js +58 -0
- package/config/prettier.mjs +30 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.js +6 -0
- package/dist/contact.d.ts +2 -0
- package/dist/contact.js +8 -0
- package/dist/date.d.ts +26 -0
- package/dist/date.js +72 -0
- package/dist/design.d.ts +166 -0
- package/dist/design.js +175 -0
- package/dist/icons.d.ts +13 -0
- package/dist/icons.js +15 -0
- package/dist/image-size.d.ts +10 -0
- package/dist/image-size.js +70 -0
- package/dist/integration.d.ts +13 -0
- package/dist/integration.js +90 -0
- package/dist/path.d.ts +1 -0
- package/dist/path.js +5 -0
- package/dist/schedule.d.ts +30 -0
- package/dist/schedule.js +117 -0
- package/dist/social.d.ts +35 -0
- package/dist/social.js +37 -0
- package/dist/structured-data.d.ts +1 -0
- package/dist/structured-data.js +2 -0
- package/dist/text.d.ts +3 -0
- package/dist/text.js +30 -0
- package/dist/types.d.ts +35 -0
- package/dist/types.js +1 -0
- package/dist/uploads.d.ts +7 -0
- package/dist/uploads.js +64 -0
- package/package.json +75 -0
- package/routes/design.css.ts +7 -0
- package/routes/theme.js.ts +28 -0
- package/routes/virtual.d.ts +6 -0
- package/schemas/design.schema.json +214 -0
- package/schemas/promo.schema.json +37 -0
- package/styles/schedule.css +17 -0
- package/styles/table.css +8 -0
- package/styles/theme-toggle.css +13 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
import ValueList from './ValueList.astro';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
hours: readonly { days: string; times: readonly string[] }[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const items = Astro.props.hours.map(entry => ({
|
|
9
|
+
label: entry.days,
|
|
10
|
+
value: entry.times,
|
|
11
|
+
}));
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<ValueList items={items} />
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The start of a content page: title and a line under it on the left, actions
|
|
3
|
+
// on the right. The counterpart to SectionHead, which opens a section.
|
|
4
|
+
interface Props {
|
|
5
|
+
title: string;
|
|
6
|
+
text?: string;
|
|
7
|
+
level?: 'h1' | 'h2';
|
|
8
|
+
// Without the rule under it.
|
|
9
|
+
plain?: boolean;
|
|
10
|
+
class?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
title,
|
|
15
|
+
text,
|
|
16
|
+
level = 'h1',
|
|
17
|
+
plain = false,
|
|
18
|
+
class: className,
|
|
19
|
+
} = Astro.props;
|
|
20
|
+
const Title = level;
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
<header
|
|
24
|
+
class:list={['mw-page-header', plain && 'mw-page-header-plain', className]}
|
|
25
|
+
>
|
|
26
|
+
<div>
|
|
27
|
+
<Title>{title}</Title>
|
|
28
|
+
{text && <p>{text}</p>}
|
|
29
|
+
<slot name="meta" />
|
|
30
|
+
</div>
|
|
31
|
+
{
|
|
32
|
+
Astro.slots.has('actions') && (
|
|
33
|
+
<div class="mw-page-header-actions">
|
|
34
|
+
<slot name="actions" />
|
|
35
|
+
</div>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
</header>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
// One photo from public/ as WebP and JPEG in several widths, named
|
|
3
|
+
// <src>-<width>.webp and <src>-<width>.jpg. The box comes from the widest JPEG,
|
|
4
|
+
// so nothing jumps while it loads.
|
|
5
|
+
import { imageSize } from '../dist/image-size.js';
|
|
6
|
+
import { withBase } from '../dist/path.js';
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
// Without width and extension: "/images/profil" for profil-500.jpg
|
|
10
|
+
src: string;
|
|
11
|
+
alt: string;
|
|
12
|
+
sizes: string;
|
|
13
|
+
widths?: readonly number[];
|
|
14
|
+
// The first impression - the hero photo, never one further down.
|
|
15
|
+
eager?: boolean;
|
|
16
|
+
class?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
src,
|
|
21
|
+
alt,
|
|
22
|
+
sizes,
|
|
23
|
+
widths = [260, 500],
|
|
24
|
+
eager = false,
|
|
25
|
+
class: className,
|
|
26
|
+
} = Astro.props;
|
|
27
|
+
|
|
28
|
+
const widest = Math.max(...widths);
|
|
29
|
+
const file = (width: number, type: string) =>
|
|
30
|
+
withBase(`${src}-${width}.${type}`);
|
|
31
|
+
const srcset = (type: string) =>
|
|
32
|
+
widths.map(width => `${file(width, type)} ${width}w`).join(', ');
|
|
33
|
+
const size = imageSize(`${src}-${widest}.jpg`);
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
<picture>
|
|
37
|
+
<source type="image/webp" srcset={srcset('webp')} sizes={sizes} />
|
|
38
|
+
<img
|
|
39
|
+
class={className}
|
|
40
|
+
src={file(widest, 'jpg')}
|
|
41
|
+
srcset={srcset('jpg')}
|
|
42
|
+
sizes={sizes}
|
|
43
|
+
width={size?.width}
|
|
44
|
+
height={size?.height}
|
|
45
|
+
alt={alt}
|
|
46
|
+
loading={eager ? undefined : 'lazy'}
|
|
47
|
+
fetchpriority={eager ? 'high' : undefined}
|
|
48
|
+
decoding="async"
|
|
49
|
+
/>
|
|
50
|
+
</picture>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Upright photos in a strip the browser scrolls itself, the next one peeks in
|
|
3
|
+
// at the edge. A landscape photo is shown whole over a blurred copy. The script
|
|
4
|
+
// adds arrows and dots.
|
|
5
|
+
import { publicImage } from '../dist/image-size.js';
|
|
6
|
+
import { withBase } from '../dist/path.js';
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
slides: readonly {
|
|
10
|
+
// From public/. With video, src is its poster.
|
|
11
|
+
src: string;
|
|
12
|
+
video?: string;
|
|
13
|
+
alt: string;
|
|
14
|
+
title?: string;
|
|
15
|
+
text?: string;
|
|
16
|
+
}[];
|
|
17
|
+
// Names the strip for screen readers.
|
|
18
|
+
label: string;
|
|
19
|
+
// Story shape, 9:16.
|
|
20
|
+
tall?: boolean;
|
|
21
|
+
gap?: 'sm' | 'lg';
|
|
22
|
+
class?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { slides, label, tall = false, gap, class: className } = Astro.props;
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
<div
|
|
29
|
+
class:list={[
|
|
30
|
+
'mw-portrait-gallery',
|
|
31
|
+
tall && 'mw-portrait-gallery-tall',
|
|
32
|
+
gap && `mw-portrait-gallery-gap-${gap}`,
|
|
33
|
+
className,
|
|
34
|
+
]}
|
|
35
|
+
>
|
|
36
|
+
<div class="mw-portrait-gallery-track" tabindex="0" aria-label={label}>
|
|
37
|
+
{
|
|
38
|
+
slides.map(slide => (
|
|
39
|
+
<figure class="mw-portrait-gallery-slide">
|
|
40
|
+
{slide.video ? (
|
|
41
|
+
<video
|
|
42
|
+
src={withBase(slide.video)}
|
|
43
|
+
poster={withBase(slide.src)}
|
|
44
|
+
aria-label={slide.alt}
|
|
45
|
+
autoplay
|
|
46
|
+
muted
|
|
47
|
+
loop
|
|
48
|
+
playsinline
|
|
49
|
+
/>
|
|
50
|
+
) : (
|
|
51
|
+
<img
|
|
52
|
+
{...publicImage(slide.src)}
|
|
53
|
+
alt={slide.alt}
|
|
54
|
+
loading="lazy"
|
|
55
|
+
decoding="async"
|
|
56
|
+
/>
|
|
57
|
+
)}
|
|
58
|
+
{(slide.title || slide.text) && (
|
|
59
|
+
<figcaption>
|
|
60
|
+
{slide.title && <strong>{slide.title}</strong>}
|
|
61
|
+
{slide.text}
|
|
62
|
+
</figcaption>
|
|
63
|
+
)}
|
|
64
|
+
</figure>
|
|
65
|
+
))
|
|
66
|
+
}
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
address: { company?: string; name: string; street: string; city: string };
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const { company, name, street, city } = Astro.props.address;
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<p>
|
|
10
|
+
{
|
|
11
|
+
company && (
|
|
12
|
+
<>
|
|
13
|
+
{company}
|
|
14
|
+
<br />
|
|
15
|
+
</>
|
|
16
|
+
)
|
|
17
|
+
}{name}<br />
|
|
18
|
+
{street}<br />
|
|
19
|
+
{city}
|
|
20
|
+
</p>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
// A price, optionally with the discount of the promotion. Both amounts are in
|
|
3
|
+
// the HTML and Schedule decides which one shows - without JavaScript the
|
|
4
|
+
// regular price applies. 0 reads as free, any other text stays a word.
|
|
5
|
+
import { config } from '../dist/config.js';
|
|
6
|
+
import type { Promo } from '../dist/schedule.js';
|
|
7
|
+
import {
|
|
8
|
+
discountedPrice,
|
|
9
|
+
discountText,
|
|
10
|
+
promoInHtml,
|
|
11
|
+
} from '../dist/schedule.js';
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
amount: string | number;
|
|
15
|
+
// Only prices that take part in the promotion get it.
|
|
16
|
+
promo?: Promo | null;
|
|
17
|
+
size?: 'xs' | 'sm' | 'lg';
|
|
18
|
+
currency?: string;
|
|
19
|
+
period?: string;
|
|
20
|
+
labels?: { free?: string; regular?: string; now?: string };
|
|
21
|
+
class?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const german = config.site.lang.startsWith('de');
|
|
25
|
+
|
|
26
|
+
const {
|
|
27
|
+
amount,
|
|
28
|
+
promo,
|
|
29
|
+
size,
|
|
30
|
+
currency = 'Euro',
|
|
31
|
+
period,
|
|
32
|
+
labels = {},
|
|
33
|
+
class: className,
|
|
34
|
+
} = Astro.props;
|
|
35
|
+
|
|
36
|
+
const {
|
|
37
|
+
free = german ? 'kostenlos' : 'free',
|
|
38
|
+
regular = german ? 'Regulärer Preis:' : 'Regular price:',
|
|
39
|
+
now = german ? 'Jetzt:' : 'Now:',
|
|
40
|
+
} = labels;
|
|
41
|
+
|
|
42
|
+
// Checked against '' instead of truthiness - a 0 has to stay a price.
|
|
43
|
+
const value = Number(amount);
|
|
44
|
+
const isNumber = String(amount).trim() !== '' && Number.isFinite(value);
|
|
45
|
+
const isAmount = isNumber && value > 0;
|
|
46
|
+
const word = isNumber ? free : amount;
|
|
47
|
+
const withDiscount = isAmount && promoInHtml(promo);
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
<p class:list={['mw-price', size && `mw-price-${size}`, className]}>
|
|
51
|
+
{
|
|
52
|
+
withDiscount && (
|
|
53
|
+
<span class="mw-price-original mwa-promo-only">
|
|
54
|
+
<span class="mw-sr-only">{regular}</span>
|
|
55
|
+
{value} {currency}
|
|
56
|
+
</span>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
{withDiscount && <span class="mw-sr-only mwa-promo-only">{now}</span>}
|
|
60
|
+
{
|
|
61
|
+
isAmount && (
|
|
62
|
+
<span class:list={['mw-price-amount', withDiscount && 'mwa-no-promo']}>
|
|
63
|
+
{value}
|
|
64
|
+
</span>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
{
|
|
68
|
+
withDiscount && (
|
|
69
|
+
<span class="mw-price-amount mwa-promo-only">
|
|
70
|
+
{discountedPrice(promo, value)}
|
|
71
|
+
</span>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
{isAmount && <span class="mw-price-currency">{currency}</span>}
|
|
75
|
+
{!isAmount && <span class="mw-price-word">{word}</span>}
|
|
76
|
+
{isAmount && period && <span class="mw-price-period">{period}</span>}
|
|
77
|
+
{
|
|
78
|
+
withDiscount && (
|
|
79
|
+
<span class="mw-tag mw-tag-secondary mwa-promo-only">
|
|
80
|
+
{discountText(promo)}
|
|
81
|
+
</span>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
</p>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Privacy policy from privacy.json: notice on top, then the controller and the
|
|
3
|
+
// sections. A paragraph given as an object is one that has to stand out (right
|
|
4
|
+
// to object under Art. 21 GDPR).
|
|
5
|
+
import PostalAddress from './PostalAddress.astro';
|
|
6
|
+
|
|
7
|
+
type Paragraph = string | { text: string };
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
privacy: {
|
|
11
|
+
updated: string;
|
|
12
|
+
noticeTitle: string;
|
|
13
|
+
noticeText: string;
|
|
14
|
+
controller: { title: string; intro: string; explanation: string };
|
|
15
|
+
sections: readonly { title: string; paragraphs: readonly Paragraph[] }[];
|
|
16
|
+
};
|
|
17
|
+
address: { company?: string; name: string; street: string; city: string };
|
|
18
|
+
mail: { href: string; text: string };
|
|
19
|
+
updatedLabel?: string;
|
|
20
|
+
classes?: { card?: string; highlight?: string };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
privacy,
|
|
25
|
+
address,
|
|
26
|
+
mail,
|
|
27
|
+
updatedLabel = 'Stand',
|
|
28
|
+
classes = {},
|
|
29
|
+
} = Astro.props;
|
|
30
|
+
const { controller } = privacy;
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<div class:list={['mw-alert mw-alert-info', classes.card]}>
|
|
34
|
+
<div class="mw-alert-content">
|
|
35
|
+
<p class="mw-alert-title">{privacy.noticeTitle}</p>
|
|
36
|
+
<p>{privacy.noticeText}</p>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div class:list={['mw-card mw-card-simple mw-prose', classes.card]}>
|
|
41
|
+
<h2>{controller.title}</h2>
|
|
42
|
+
<p>{controller.intro}</p>
|
|
43
|
+
<PostalAddress address={address} />
|
|
44
|
+
<p>E-Mail: <a href={mail.href}>{mail.text}</a></p>
|
|
45
|
+
<p>{controller.explanation}</p>
|
|
46
|
+
|
|
47
|
+
{
|
|
48
|
+
privacy.sections.map(section => (
|
|
49
|
+
<Fragment>
|
|
50
|
+
<h2>{section.title}</h2>
|
|
51
|
+
{section.paragraphs.map(paragraph =>
|
|
52
|
+
typeof paragraph === 'string' ? (
|
|
53
|
+
<p>{paragraph}</p>
|
|
54
|
+
) : (
|
|
55
|
+
<p class={classes.highlight}>{paragraph.text}</p>
|
|
56
|
+
)
|
|
57
|
+
)}
|
|
58
|
+
</Fragment>
|
|
59
|
+
))
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
<p class="mw-text-sm mw-text-muted mw-mt-8">
|
|
63
|
+
{updatedLabel}: {privacy.updated}
|
|
64
|
+
</p>
|
|
65
|
+
</div>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
// A bar with its label and value. The fill runs up from zero when it scrolls
|
|
3
|
+
// into view - the MaverickWave script starts it from data-value.
|
|
4
|
+
interface Props {
|
|
5
|
+
label: string;
|
|
6
|
+
// 0 to 100, how far the bar fills
|
|
7
|
+
value: number;
|
|
8
|
+
// Shown instead of "<value> %", e.g. "7 von 10"
|
|
9
|
+
text?: string;
|
|
10
|
+
// Label and value only for screen readers.
|
|
11
|
+
hideInfo?: boolean;
|
|
12
|
+
inline?: boolean;
|
|
13
|
+
size?: 'sm' | 'lg';
|
|
14
|
+
color?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger';
|
|
15
|
+
class?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const {
|
|
19
|
+
label,
|
|
20
|
+
value,
|
|
21
|
+
text,
|
|
22
|
+
hideInfo = false,
|
|
23
|
+
inline = false,
|
|
24
|
+
size,
|
|
25
|
+
color,
|
|
26
|
+
class: className,
|
|
27
|
+
} = Astro.props;
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<div
|
|
31
|
+
class:list={[
|
|
32
|
+
'mw-progress-container',
|
|
33
|
+
inline && 'mw-progress-inline-label',
|
|
34
|
+
size && `mw-progress-${size}`,
|
|
35
|
+
className,
|
|
36
|
+
]}
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
class:list={['mw-progress-barinfo', hideInfo && 'mw-progress-hide-info']}
|
|
40
|
+
>
|
|
41
|
+
<span class="mw-progress-label">{label}</span>
|
|
42
|
+
<span class:list={['mw-progress-value', !text && 'mw-progress-percent']}>
|
|
43
|
+
{text ?? value}
|
|
44
|
+
</span>
|
|
45
|
+
</div>
|
|
46
|
+
<div class="mw-progress-bar">
|
|
47
|
+
<div
|
|
48
|
+
class:list={['mw-progress-fill', color && `mw-progress-${color}`]}
|
|
49
|
+
data-value={value}
|
|
50
|
+
>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { Promo } from '../dist/schedule.js';
|
|
3
|
+
import { discountText, promoInHtml, promoText } from '../dist/schedule.js';
|
|
4
|
+
import Announcement from './Announcement.astro';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
promo: Promo;
|
|
8
|
+
href: string;
|
|
9
|
+
// Append "bis DD.MM.YYYY" to the text.
|
|
10
|
+
withEndDate?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const { promo, href, withEndDate = false } = Astro.props;
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
{
|
|
17
|
+
promoInHtml(promo) && (
|
|
18
|
+
<Announcement
|
|
19
|
+
highlight={discountText(promo)}
|
|
20
|
+
text={withEndDate ? promoText(promo) : promo.text}
|
|
21
|
+
href={href}
|
|
22
|
+
class="mwa-promo-only"
|
|
23
|
+
/>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The HTML holds everything that might still apply. This script only removes
|
|
3
|
+
// what has expired or not started yet - without the script everything stays,
|
|
4
|
+
// never the other way round.
|
|
5
|
+
import '../styles/schedule.css';
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
const html = document.documentElement;
|
|
10
|
+
const now = new Date();
|
|
11
|
+
|
|
12
|
+
// Promotion: data-promo-from and data-promo-until on <html>. Without
|
|
13
|
+
// "until" there is no promotion; empty means open-ended.
|
|
14
|
+
const { promoFrom, promoUntil } = html.dataset;
|
|
15
|
+
if (
|
|
16
|
+
promoUntil !== undefined &&
|
|
17
|
+
(promoUntil === '' || new Date(promoUntil) >= now) &&
|
|
18
|
+
(!promoFrom || new Date(promoFrom) <= now)
|
|
19
|
+
) {
|
|
20
|
+
html.classList.add('mwa-promo-active');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
document
|
|
24
|
+
.querySelectorAll<HTMLElement>('[data-starts], [data-expires]')
|
|
25
|
+
.forEach(element => {
|
|
26
|
+
const { starts, expires } = element.dataset;
|
|
27
|
+
if (
|
|
28
|
+
(expires && new Date(expires) < now) ||
|
|
29
|
+
(starts && new Date(starts) > now)
|
|
30
|
+
) {
|
|
31
|
+
element.remove();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// A list without remaining entries is replaced by the template right after
|
|
36
|
+
// it, or removed altogether.
|
|
37
|
+
document.querySelectorAll('[data-schedule-list]').forEach(list => {
|
|
38
|
+
if (list.querySelector('[data-starts], [data-expires]')) return;
|
|
39
|
+
const empty = list.nextElementSibling;
|
|
40
|
+
if (
|
|
41
|
+
empty instanceof HTMLTemplateElement &&
|
|
42
|
+
'scheduleEmpty' in empty.dataset
|
|
43
|
+
) {
|
|
44
|
+
list.replaceWith(empty.content.cloneNode(true));
|
|
45
|
+
} else {
|
|
46
|
+
list.remove();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// The build only knows its own day - "today" in a calendar or on a date
|
|
51
|
+
// stamp moves along here.
|
|
52
|
+
const pad = (value: number) => String(value).padStart(2, '0');
|
|
53
|
+
const today = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
|
|
54
|
+
document.querySelectorAll<HTMLElement>('[data-day]').forEach(day => {
|
|
55
|
+
const mark = day.classList.contains('mw-date-stamp')
|
|
56
|
+
? 'mw-date-stamp-today'
|
|
57
|
+
: 'mw-calendar-today';
|
|
58
|
+
day.classList.toggle(mark, day.dataset.day === today);
|
|
59
|
+
});
|
|
60
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
title: string;
|
|
4
|
+
intro?: string;
|
|
5
|
+
numbered?: boolean;
|
|
6
|
+
// h1 for subpages, whose head is the page title as well.
|
|
7
|
+
level?: 'h1' | 'h2';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { title, intro, numbered = false, level = 'h2' } = Astro.props;
|
|
11
|
+
const Title = level;
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<div class:list={['mw-section-head', numbered && 'mw-section-head-numbered']}>
|
|
15
|
+
<Title class="mw-section-head-title">{title}</Title>
|
|
16
|
+
{intro && <p class="mw-section-head-intro">{intro}</p>}
|
|
17
|
+
<slot />
|
|
18
|
+
</div>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The round icon links in the footer. The icons come from the package, so
|
|
3
|
+
// every site shows the same set.
|
|
4
|
+
import { SOCIAL_ICONS, type SocialType } from '../dist/social.js';
|
|
5
|
+
|
|
6
|
+
export type SocialLink = {
|
|
7
|
+
type: SocialType;
|
|
8
|
+
href: string;
|
|
9
|
+
label: string;
|
|
10
|
+
tooltip?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
links: readonly SocialLink[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { links } = Astro.props;
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
<div class="mw-social-links">
|
|
21
|
+
{
|
|
22
|
+
links.map(link => {
|
|
23
|
+
const icon = SOCIAL_ICONS[link.type];
|
|
24
|
+
const external = /^https?:/.test(link.href);
|
|
25
|
+
return (
|
|
26
|
+
<a
|
|
27
|
+
href={link.href}
|
|
28
|
+
data-tooltip={link.tooltip ?? link.label}
|
|
29
|
+
aria-label={link.label}
|
|
30
|
+
target={external ? '_blank' : undefined}
|
|
31
|
+
rel={external ? 'noopener noreferrer' : undefined}
|
|
32
|
+
>
|
|
33
|
+
<svg
|
|
34
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
35
|
+
viewBox={icon.viewBox}
|
|
36
|
+
width="1em"
|
|
37
|
+
height="1em"
|
|
38
|
+
fill="currentColor"
|
|
39
|
+
aria-hidden="true"
|
|
40
|
+
focusable="false"
|
|
41
|
+
set:html={icon.body}
|
|
42
|
+
/>
|
|
43
|
+
</a>
|
|
44
|
+
);
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
</div>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
// A process with a known number of steps. Without current every step is just
|
|
3
|
+
// its number - the "how it works" of a homepage. With current the steps before
|
|
4
|
+
// it are done and ticked.
|
|
5
|
+
import { PACKAGE_ICONS } from '../dist/icons.js';
|
|
6
|
+
import Icon from './Icon.astro';
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
steps: readonly { label: string; text?: string }[];
|
|
10
|
+
// Index of the step the reader is at.
|
|
11
|
+
current?: number;
|
|
12
|
+
// Label and text beside each step instead of labels under a row.
|
|
13
|
+
vertical?: boolean;
|
|
14
|
+
class?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { steps, current, vertical = false, class: className } = Astro.props;
|
|
18
|
+
|
|
19
|
+
const state = (index: number) =>
|
|
20
|
+
current === undefined
|
|
21
|
+
? undefined
|
|
22
|
+
: index < current
|
|
23
|
+
? 'mw-done'
|
|
24
|
+
: index === current
|
|
25
|
+
? 'mw-active'
|
|
26
|
+
: undefined;
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
{
|
|
30
|
+
vertical ? (
|
|
31
|
+
<div class:list={['mw-stepper-vertical', className]}>
|
|
32
|
+
{steps.map((step, index) => (
|
|
33
|
+
<div class:list={['mw-stepper-step', state(index)]}>
|
|
34
|
+
<div class:list={['mw-stepper-indicator', state(index)]}>
|
|
35
|
+
{state(index) === 'mw-done' ? (
|
|
36
|
+
<Icon svg={PACKAGE_ICONS.check} size={16} />
|
|
37
|
+
) : (
|
|
38
|
+
index + 1
|
|
39
|
+
)}
|
|
40
|
+
</div>
|
|
41
|
+
<div class="mw-stepper-content">
|
|
42
|
+
<p class="mw-stepper-content-title">{step.label}</p>
|
|
43
|
+
{step.text && <p class="mw-stepper-content-desc">{step.text}</p>}
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
))}
|
|
47
|
+
</div>
|
|
48
|
+
) : (
|
|
49
|
+
<div class:list={['mw-stepper', className]}>
|
|
50
|
+
{steps.map((step, index) => (
|
|
51
|
+
<>
|
|
52
|
+
{index > 0 && (
|
|
53
|
+
<div
|
|
54
|
+
class:list={[
|
|
55
|
+
'mw-stepper-connector',
|
|
56
|
+
state(index - 1) === 'mw-done' && 'mw-done',
|
|
57
|
+
]}
|
|
58
|
+
/>
|
|
59
|
+
)}
|
|
60
|
+
<div class="mw-stepper-step">
|
|
61
|
+
<div class:list={['mw-stepper-indicator', state(index)]}>
|
|
62
|
+
{state(index) === 'mw-done' ? (
|
|
63
|
+
<Icon svg={PACKAGE_ICONS.check} size={16} />
|
|
64
|
+
) : (
|
|
65
|
+
index + 1
|
|
66
|
+
)}
|
|
67
|
+
</div>
|
|
68
|
+
<span class:list={['mw-stepper-label', state(index)]}>
|
|
69
|
+
{step.label}
|
|
70
|
+
</span>
|
|
71
|
+
</div>
|
|
72
|
+
</>
|
|
73
|
+
))}
|
|
74
|
+
</div>
|
|
75
|
+
)
|
|
76
|
+
}
|