maverick-wave-astro 1.19.0 → 1.21.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/components/Hero.astro +12 -2
- package/components/Price.astro +7 -1
- package/components/Schedule.astro +3 -3
- package/components/Spinner.astro +3 -3
- package/components/SplitHero.astro +13 -2
- package/components/Stack.astro +16 -0
- package/dist/schedule.js +9 -16
- package/package.json +3 -3
- package/schemas/promo.schema.json +1 -1
package/components/Hero.astro
CHANGED
|
@@ -19,6 +19,7 @@ interface Props {
|
|
|
19
19
|
badge?: { text: string; pulse?: boolean };
|
|
20
20
|
cta?: Link;
|
|
21
21
|
secondaryCta?: Link;
|
|
22
|
+
ctaShine?: boolean;
|
|
22
23
|
scrollHint?: Link & { ariaLabel: string };
|
|
23
24
|
classes?: {
|
|
24
25
|
hero?: string;
|
|
@@ -44,6 +45,7 @@ const {
|
|
|
44
45
|
badge,
|
|
45
46
|
cta,
|
|
46
47
|
secondaryCta,
|
|
48
|
+
ctaShine = false,
|
|
47
49
|
scrollHint,
|
|
48
50
|
classes = {},
|
|
49
51
|
} = Astro.props;
|
|
@@ -120,7 +122,11 @@ const button = classes.buttons ?? 'mw-btn-lg';
|
|
|
120
122
|
>
|
|
121
123
|
{cta && (
|
|
122
124
|
<a
|
|
123
|
-
class:list={[
|
|
125
|
+
class:list={[
|
|
126
|
+
'mw-btn mw-btn-primary',
|
|
127
|
+
ctaShine && 'mw-btn-shine',
|
|
128
|
+
button,
|
|
129
|
+
]}
|
|
124
130
|
href={cta.href}
|
|
125
131
|
>
|
|
126
132
|
<slot name="cta-icon" />
|
|
@@ -129,7 +135,11 @@ const button = classes.buttons ?? 'mw-btn-lg';
|
|
|
129
135
|
)}
|
|
130
136
|
{secondaryCta && (
|
|
131
137
|
<a
|
|
132
|
-
class:list={[
|
|
138
|
+
class:list={[
|
|
139
|
+
'mw-btn mw-btn-outline',
|
|
140
|
+
Astro.slots.has('secondary-icon') && 'mw-btn-forward',
|
|
141
|
+
button,
|
|
142
|
+
]}
|
|
133
143
|
href={secondaryCta.href}
|
|
134
144
|
>
|
|
135
145
|
{secondaryCta.label}
|
package/components/Price.astro
CHANGED
|
@@ -15,10 +15,12 @@ interface Props {
|
|
|
15
15
|
amount: string | number;
|
|
16
16
|
// Only prices that take part in the promotion get it.
|
|
17
17
|
promo?: Promo | null;
|
|
18
|
+
// "ab 350 Euro": the amount is a starting price.
|
|
19
|
+
from?: boolean;
|
|
18
20
|
size?: 'xs' | 'sm' | 'lg';
|
|
19
21
|
currency?: string;
|
|
20
22
|
period?: string;
|
|
21
|
-
labels?: { free?: string; regular?: string; now?: string };
|
|
23
|
+
labels?: { free?: string; regular?: string; now?: string; from?: string };
|
|
22
24
|
class?: string;
|
|
23
25
|
}
|
|
24
26
|
|
|
@@ -27,6 +29,7 @@ const german = config.site.lang.startsWith('de');
|
|
|
27
29
|
const {
|
|
28
30
|
amount,
|
|
29
31
|
promo,
|
|
32
|
+
from = false,
|
|
30
33
|
size,
|
|
31
34
|
currency = 'Euro',
|
|
32
35
|
period,
|
|
@@ -38,6 +41,7 @@ const {
|
|
|
38
41
|
free = german ? 'kostenlos' : 'free',
|
|
39
42
|
regular = german ? 'Regulärer Preis:' : 'Regular price:',
|
|
40
43
|
now = german ? 'Jetzt:' : 'Now:',
|
|
44
|
+
from: fromWord = german ? 'ab' : 'from',
|
|
41
45
|
} = labels;
|
|
42
46
|
|
|
43
47
|
// Checked against '' instead of truthiness - a 0 has to stay a price.
|
|
@@ -54,12 +58,14 @@ const { whole, fraction } = priceParts(value, siteLocale);
|
|
|
54
58
|
withDiscount && (
|
|
55
59
|
<span class="mw-price-original mwa-promo-only">
|
|
56
60
|
<span class="mw-sr-only">{regular}</span>
|
|
61
|
+
{from && `${fromWord} `}
|
|
57
62
|
{whole}
|
|
58
63
|
{fraction} {currency}
|
|
59
64
|
</span>
|
|
60
65
|
)
|
|
61
66
|
}
|
|
62
67
|
{withDiscount && <span class="mw-sr-only mwa-promo-only">{now}</span>}
|
|
68
|
+
{isAmount && from && <span class="mw-price-word">{fromWord}</span>}
|
|
63
69
|
{
|
|
64
70
|
isAmount && (
|
|
65
71
|
<span class:list={['mw-price-amount', withDiscount && 'mwa-no-promo']}>
|
|
@@ -13,11 +13,11 @@ import '../styles/schedule.css';
|
|
|
13
13
|
const now = new Date();
|
|
14
14
|
|
|
15
15
|
// Promotion: data-promo-from and data-promo-until on <html>. Without
|
|
16
|
-
// "until" there is no promotion
|
|
16
|
+
// "until" there is no promotion.
|
|
17
17
|
const { promoFrom, promoUntil } = html.dataset;
|
|
18
18
|
if (
|
|
19
|
-
promoUntil
|
|
20
|
-
|
|
19
|
+
promoUntil &&
|
|
20
|
+
new Date(promoUntil) >= now &&
|
|
21
21
|
(!promoFrom || new Date(promoFrom) <= now)
|
|
22
22
|
) {
|
|
23
23
|
html.classList.add('mwa-promo-active');
|
package/components/Spinner.astro
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
// Something is on its way. "inline" takes the size and colour of the text it
|
|
3
|
-
// sits in - a button
|
|
4
|
-
// words to that text. The others stand centred in their own box and are
|
|
5
|
-
// out by their label.
|
|
3
|
+
// sits in - a button that keeps its label, a line still loading - and leaves
|
|
4
|
+
// the words to that text. The others stand centred in their own box and are
|
|
5
|
+
// read out by their label.
|
|
6
6
|
import { config } from '../dist/config.js';
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
@@ -21,6 +21,7 @@ interface Props {
|
|
|
21
21
|
badge?: { text: string; pulse?: boolean };
|
|
22
22
|
cta?: Link;
|
|
23
23
|
secondaryCta?: Link;
|
|
24
|
+
ctaShine?: boolean;
|
|
24
25
|
// As for Picture, loaded at once - it is the first thing on the page. Or the
|
|
25
26
|
// `media` slot.
|
|
26
27
|
image?: {
|
|
@@ -44,6 +45,7 @@ const {
|
|
|
44
45
|
badge,
|
|
45
46
|
cta,
|
|
46
47
|
secondaryCta,
|
|
48
|
+
ctaShine = false,
|
|
47
49
|
image,
|
|
48
50
|
reverse = false,
|
|
49
51
|
level: Heading = 'h1',
|
|
@@ -109,14 +111,23 @@ const order = reverse ? ['media', 'text'] : ['text', 'media'];
|
|
|
109
111
|
{(cta || secondaryCta) && (
|
|
110
112
|
<div class="mw-d-flex mw-flex-wrap mw-gap-4 mw-mt-7">
|
|
111
113
|
{cta && (
|
|
112
|
-
<a
|
|
114
|
+
<a
|
|
115
|
+
class:list={[
|
|
116
|
+
'mw-btn mw-btn-primary mw-btn-lg',
|
|
117
|
+
ctaShine && 'mw-btn-shine',
|
|
118
|
+
]}
|
|
119
|
+
href={cta.href}
|
|
120
|
+
>
|
|
113
121
|
<slot name="cta-icon" />
|
|
114
122
|
{cta.label}
|
|
115
123
|
</a>
|
|
116
124
|
)}
|
|
117
125
|
{secondaryCta && (
|
|
118
126
|
<a
|
|
119
|
-
class=
|
|
127
|
+
class:list={[
|
|
128
|
+
'mw-btn mw-btn-outline mw-btn-lg',
|
|
129
|
+
Astro.slots.has('secondary-icon') && 'mw-btn-forward',
|
|
130
|
+
]}
|
|
120
131
|
href={secondaryCta.href}
|
|
121
132
|
>
|
|
122
133
|
{secondaryCta.label}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Cards that pile up while the page scrolls - a handful of projects or case
|
|
3
|
+
// studies, each a row of its own. From lg every child stops below the header,
|
|
4
|
+
// one step lower than the one before, and the next slides over it; on a phone
|
|
5
|
+
// a plain stack. Each child needs a background of its own, a mw-card has one.
|
|
6
|
+
// The offset counts up to the twelfth child.
|
|
7
|
+
interface Props {
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { class: className } = Astro.props;
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<div class:list={['mw-stack', className]}>
|
|
15
|
+
<slot />
|
|
16
|
+
</div>
|
package/dist/schedule.js
CHANGED
|
@@ -47,27 +47,20 @@ export const eventDateText = (entry, locale = 'de-DE') => {
|
|
|
47
47
|
});
|
|
48
48
|
};
|
|
49
49
|
// A planned promotion is in the HTML before its first day already - only the
|
|
50
|
-
// script makes it visible.
|
|
50
|
+
// script makes it visible. Without a last day there is none: an open-ended
|
|
51
|
+
// discount strikes through a price nobody ever pays (UWG, PAngV).
|
|
51
52
|
export const promoInHtml = (promo, now = new Date()) => {
|
|
52
53
|
const percent = Number(promo?.percent);
|
|
53
54
|
if (!promo || !Number.isFinite(percent) || percent <= 0)
|
|
54
55
|
return false;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (!end || now > end)
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
return true;
|
|
56
|
+
const end = visibleUntil(promo.until ?? '');
|
|
57
|
+
return end !== null && now <= end;
|
|
61
58
|
};
|
|
62
59
|
// Value for data-promo-until on <html>: the moment the promotion is gone.
|
|
63
|
-
//
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return null;
|
|
68
|
-
const end = promo.until ? visibleUntil(promo.until) : null;
|
|
69
|
-
return end ? end.toISOString() : '';
|
|
70
|
-
};
|
|
60
|
+
// Null means no promotion - then there is nothing in the HTML to hide either.
|
|
61
|
+
export const promoExpiry = (promo, now = new Date()) => promoInHtml(promo, now)
|
|
62
|
+
? (visibleUntil(promo.until ?? '')?.toISOString() ?? null)
|
|
63
|
+
: null;
|
|
71
64
|
// Value for data-promo-from on <html>: the moment the promotion starts. Null
|
|
72
65
|
// means it applies right away, or there is none.
|
|
73
66
|
export const promoStart = (promo, now = new Date()) => {
|
|
@@ -82,7 +75,7 @@ export const discountText = (promo) => `-${Number(promo.percent)}\u2009%`;
|
|
|
82
75
|
// promised percentage. In whole cents, because 90 * 0.7 is 62.999... in
|
|
83
76
|
// floating point.
|
|
84
77
|
export const discountedPrice = (promo, amount) => Math.floor((Math.round(amount * 100) * (100 - Number(promo.percent))) / 10_000);
|
|
85
|
-
// Last day of the promotion, formatted. Null
|
|
78
|
+
// Last day of the promotion, formatted. Null without a valid last day.
|
|
86
79
|
export const promoEndDate = (promo, locale = 'de-DE') => {
|
|
87
80
|
const end = promo.until ? endOfDay(promo.until) : null;
|
|
88
81
|
return end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "maverick-wave-astro",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0",
|
|
4
4
|
"description": "Shared frame for static Astro homepages built with MaverickWave: layout, SEO, design variants, schedule, building blocks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"astro": "^7.2.0",
|
|
56
|
-
"maverick-wave": "^6.
|
|
56
|
+
"maverick-wave": "^6.14.0"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@astrojs/sitemap": "^3.7.3",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"eslint-plugin-astro": "^1.5.0",
|
|
69
69
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
70
70
|
"globals": "^16.5.0",
|
|
71
|
-
"maverick-wave": "^6.
|
|
71
|
+
"maverick-wave": "^6.14.0",
|
|
72
72
|
"playwright-core": "^1.64.0",
|
|
73
73
|
"prettier": "^3.6.2",
|
|
74
74
|
"prettier-plugin-astro": "^0.14.1",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"until": {
|
|
29
29
|
"title": "Letzter Tag",
|
|
30
|
-
"description": "
|
|
30
|
+
"description": "Ohne letzten Tag zeigt die Homepage keinen Rabatt. Die Aktion verschwindet am Tag danach um 12 Uhr.",
|
|
31
31
|
"type": "string",
|
|
32
32
|
"format": "date",
|
|
33
33
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
|