maverick-wave-astro 1.2.0 → 1.4.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/Device.astro +60 -0
- package/components/Devices.astro +29 -0
- package/components/Faq.astro +42 -0
- package/components/LegalPage.astro +6 -4
- package/dist/faq.d.ts +17 -0
- package/dist/faq.js +14 -0
- package/package.json +3 -3
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
// One device frame drawn by the framework - a laptop or a phone - with a page
|
|
3
|
+
// on the glass: a full-page screenshot from public/, or the live page in an
|
|
4
|
+
// iframe laid out at the device's width and scaled to fit. Both frames
|
|
5
|
+
// together are Devices.
|
|
6
|
+
import { config } from '../dist/config.js';
|
|
7
|
+
import { publicImage } from '../dist/image-size.js';
|
|
8
|
+
import { linkTo } from '../dist/path.js';
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
kind: 'laptop' | 'phone';
|
|
12
|
+
// 1280px wide for the laptop, 390px for the phone, as tall as the page
|
|
13
|
+
image?: string;
|
|
14
|
+
alt?: string;
|
|
15
|
+
// The page itself instead of a picture
|
|
16
|
+
src?: string;
|
|
17
|
+
title?: string;
|
|
18
|
+
// As a button: a tap scrolls the screenshot to its end and back
|
|
19
|
+
tour?: boolean;
|
|
20
|
+
tourLabel?: string;
|
|
21
|
+
class?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const german = config.site.lang.startsWith('de');
|
|
25
|
+
|
|
26
|
+
const {
|
|
27
|
+
kind,
|
|
28
|
+
image,
|
|
29
|
+
alt = '',
|
|
30
|
+
src,
|
|
31
|
+
title,
|
|
32
|
+
tour = false,
|
|
33
|
+
tourLabel = german ? 'Seite durchscrollen' : 'Scroll through the page',
|
|
34
|
+
class: className,
|
|
35
|
+
} = Astro.props;
|
|
36
|
+
|
|
37
|
+
// A live page scrolls by itself - the tour needs a picture to move
|
|
38
|
+
const button = tour && Boolean(image);
|
|
39
|
+
const Frame = button ? 'button' : 'div';
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
<Frame
|
|
43
|
+
class:list={['mw-device', `mw-device-${kind}`, className]}
|
|
44
|
+
{...button ? { type: 'button', 'aria-label': tourLabel } : {}}
|
|
45
|
+
>
|
|
46
|
+
<span class="mw-device-screen">
|
|
47
|
+
{
|
|
48
|
+
image ? (
|
|
49
|
+
<img
|
|
50
|
+
{...publicImage(image)}
|
|
51
|
+
alt={alt}
|
|
52
|
+
loading="lazy"
|
|
53
|
+
decoding="async"
|
|
54
|
+
/>
|
|
55
|
+
) : (
|
|
56
|
+
src && <iframe src={linkTo(src)} title={title} loading="lazy" />
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
</span>
|
|
60
|
+
</Frame>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Laptop and phone together: the phone stands over the laptop's lower right
|
|
3
|
+
// corner, below it once the container gets narrow. Each screen takes what
|
|
4
|
+
// Device takes.
|
|
5
|
+
import Device from './Device.astro';
|
|
6
|
+
|
|
7
|
+
interface Screen {
|
|
8
|
+
image?: string;
|
|
9
|
+
alt?: string;
|
|
10
|
+
src?: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
laptop: Screen;
|
|
16
|
+
phone: Screen;
|
|
17
|
+
// The phone scrolls its screenshot on a tap - only with an image on it
|
|
18
|
+
tour?: boolean;
|
|
19
|
+
tourLabel?: string;
|
|
20
|
+
class?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const { laptop, phone, tour = true, tourLabel, class: className } = Astro.props;
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
<div class:list={['mw-devices', className]}>
|
|
27
|
+
<Device kind="laptop" {...laptop} />
|
|
28
|
+
<Device kind="phone" {...phone} tour={tour} tourLabel={tourLabel} />
|
|
29
|
+
</div>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The item ids count from 1 and are link targets: #frage-3 opens the third one.
|
|
3
|
+
import { answerParagraphs, type Question } from '../dist/faq.js';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
items: readonly Question[];
|
|
7
|
+
idPrefix: string;
|
|
8
|
+
variant?: 'lines' | 'cards';
|
|
9
|
+
firstOpen?: boolean;
|
|
10
|
+
single?: boolean;
|
|
11
|
+
class?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const {
|
|
15
|
+
items,
|
|
16
|
+
idPrefix,
|
|
17
|
+
variant = 'lines',
|
|
18
|
+
firstOpen = false,
|
|
19
|
+
single = false,
|
|
20
|
+
class: className,
|
|
21
|
+
} = Astro.props;
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<div class:list={['mw-faq', variant === 'cards' && 'mw-faq-cards', className]}>
|
|
25
|
+
{
|
|
26
|
+
items.map((item, index) => (
|
|
27
|
+
<details
|
|
28
|
+
class="mw-faq-item"
|
|
29
|
+
id={`${idPrefix}${index + 1}`}
|
|
30
|
+
name={single ? idPrefix : undefined}
|
|
31
|
+
open={firstOpen && index === 0}
|
|
32
|
+
>
|
|
33
|
+
<summary class="mw-faq-question">{item.question}</summary>
|
|
34
|
+
<div class="mw-faq-answer">
|
|
35
|
+
{answerParagraphs(item.answer).map(paragraph => (
|
|
36
|
+
<p>{paragraph}</p>
|
|
37
|
+
))}
|
|
38
|
+
</div>
|
|
39
|
+
</details>
|
|
40
|
+
))
|
|
41
|
+
}
|
|
42
|
+
</div>
|
|
@@ -11,9 +11,11 @@ const { title, notice, noticeType = 'warning' } = Astro.props;
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
13
|
<section class="mw-section">
|
|
14
|
-
<div class="mw-container mw-content
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
<div class="mw-container mw-content">
|
|
15
|
+
<div class="mw-container-narrow mw-prose">
|
|
16
|
+
<h1>{title}</h1>
|
|
17
|
+
{notice && <div class={`mw-alert mw-alert-${noticeType}`}>{notice}</div>}
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
18
20
|
</div>
|
|
19
21
|
</section>
|
package/dist/faq.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type Question = {
|
|
2
|
+
question: string;
|
|
3
|
+
answer: string | readonly string[];
|
|
4
|
+
};
|
|
5
|
+
export declare const answerParagraphs: (answer: Question["answer"]) => readonly string[];
|
|
6
|
+
export declare const faqPage: (questions: readonly Question[], id: string) => {
|
|
7
|
+
'@type': string;
|
|
8
|
+
'@id': string;
|
|
9
|
+
mainEntity: {
|
|
10
|
+
'@type': string;
|
|
11
|
+
name: string;
|
|
12
|
+
acceptedAnswer: {
|
|
13
|
+
'@type': string;
|
|
14
|
+
text: string;
|
|
15
|
+
};
|
|
16
|
+
}[];
|
|
17
|
+
};
|
package/dist/faq.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const answerParagraphs = (answer) => typeof answer === 'string' ? [answer] : answer;
|
|
2
|
+
// Built from the list the page shows - Google drops the markup when the two differ.
|
|
3
|
+
export const faqPage = (questions, id) => ({
|
|
4
|
+
'@type': 'FAQPage',
|
|
5
|
+
'@id': id,
|
|
6
|
+
mainEntity: questions.map(({ question, answer }) => ({
|
|
7
|
+
'@type': 'Question',
|
|
8
|
+
name: question,
|
|
9
|
+
acceptedAnswer: {
|
|
10
|
+
'@type': 'Answer',
|
|
11
|
+
text: answerParagraphs(answer).join(' '),
|
|
12
|
+
},
|
|
13
|
+
})),
|
|
14
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "maverick-wave-astro",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.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",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"astro": "^7.2.0",
|
|
54
|
-
"maverick-wave": "^5.
|
|
54
|
+
"maverick-wave": "^5.39.0"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@astrojs/sitemap": "^3.7.3",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"eslint-plugin-astro": "^1.5.0",
|
|
67
67
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
68
68
|
"globals": "^16.5.0",
|
|
69
|
-
"maverick-wave": "^5.
|
|
69
|
+
"maverick-wave": "^5.39.0",
|
|
70
70
|
"prettier": "^3.6.2",
|
|
71
71
|
"prettier-plugin-astro": "^0.14.1",
|
|
72
72
|
"typescript": "^6.0.3",
|