@prokodo/ui 0.0.52 → 0.0.53
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 +81 -81
- package/dist/components/accordion/Accordion.client.js +3 -1
- package/dist/components/accordion/Accordion.view.js +100 -81
- package/dist/components/animated/Animated.server.js +3 -1
- package/dist/components/animatedText/AnimatedText.client.js +1 -7
- package/dist/components/animatedText/AnimatedText.view.js +4 -1
- package/dist/components/avatar/Avatar.view.js +2 -2
- package/dist/components/base-link/BaseLink.view.js +1 -1
- package/dist/components/button/Button.server.js +1 -8
- package/dist/components/calendly/Calendly.client.js +63 -54
- package/dist/components/calendly/Calendly.server.js +3 -1
- package/dist/components/card/Card.client.js +2 -1
- package/dist/components/card/Card.effects.client.js +5 -1
- package/dist/components/card/Card.view.js +19 -2
- package/dist/components/carousel/Carousel.client.js +36 -12
- package/dist/components/chip/Chip.view.js +10 -6
- package/dist/components/datePicker/DatePicker.client.js +53 -37
- package/dist/components/datePicker/DatePicker.view.js +3 -1
- package/dist/components/dialog/Dialog.client.js +22 -14
- package/dist/components/dialog/Dialog.view.js +10 -2
- package/dist/components/drawer/Drawer.client.js +10 -2
- package/dist/components/drawer/Drawer.effects.client.js +7 -2
- package/dist/components/dynamic-list/DynamicList.client.js +8 -7
- package/dist/components/dynamic-list/DynamicList.server.js +10 -4
- package/dist/components/dynamic-list/DynamicList.view.js +1 -1
- package/dist/components/form/Form.client.js +16 -13
- package/dist/components/form/Form.view.js +8 -4
- package/dist/components/form/FormField.client.js +5 -5
- package/dist/components/form/FormField.server.js +3 -23
- package/dist/components/form/FormResponse.js +5 -1
- package/dist/components/grid/Grid.js +7 -2
- package/dist/components/grid/GridRow.js +12 -2
- package/dist/components/headline/Headline.js +3 -1
- package/dist/components/icon/Icon.js +8 -4
- package/dist/components/image-text/ImageText.js +5 -1
- package/dist/components/input/Input.client.js +52 -28
- package/dist/components/input/Input.view.js +92 -68
- package/dist/components/inputOTP/InputOTP.js +107 -90
- package/dist/components/label/Label.js +1 -8
- package/dist/components/link/Link.view.js +3 -1
- package/dist/components/list/List.js +94 -42
- package/dist/components/loading/Loading.client.js +15 -2
- package/dist/components/loading/Loading.server.js +8 -1
- package/dist/components/loading/Loading.view.js +30 -7
- package/dist/components/post-item/PostItem.client.js +18 -0
- package/dist/components/post-item/PostItem.js +7 -136
- package/dist/components/post-item/PostItem.lazy.js +14 -0
- package/dist/components/post-item/PostItem.module.scss.js +3 -1
- package/dist/components/post-item/PostItem.server.js +15 -0
- package/dist/components/post-item/PostItem.view.js +238 -0
- package/dist/components/post-item/PostItemAuthor.js +28 -22
- package/dist/components/post-teaser/PostTeaser.client.js +31 -0
- package/dist/components/post-teaser/PostTeaser.js +9 -169
- package/dist/components/post-teaser/PostTeaser.lazy.js +13 -0
- package/dist/components/post-teaser/PostTeaser.module.scss.js +3 -0
- package/dist/components/post-teaser/PostTeaser.server.js +23 -0
- package/dist/components/post-teaser/PostTeaser.view.js +252 -0
- package/dist/components/post-widget/PostWidget.client.js +9 -0
- package/dist/components/post-widget/PostWidget.js +11 -156
- package/dist/components/post-widget/PostWidget.lazy.js +13 -0
- package/dist/components/post-widget/PostWidget.module.scss.js +1 -0
- package/dist/components/post-widget/PostWidget.server.js +11 -0
- package/dist/components/post-widget/PostWidget.view.js +263 -0
- package/dist/components/post-widget-carousel/PostWidgetCarousel.client.js +9 -0
- package/dist/components/post-widget-carousel/PostWidgetCarousel.js +9 -160
- package/dist/components/post-widget-carousel/PostWidgetCarousel.lazy.js +13 -0
- package/dist/components/post-widget-carousel/PostWidgetCarousel.module.scss.js +3 -0
- package/dist/components/post-widget-carousel/PostWidgetCarousel.server.js +11 -0
- package/dist/components/post-widget-carousel/PostWidgetCarousel.view.js +244 -0
- package/dist/components/rich-text/RichText.client.js +7 -2
- package/dist/components/select/Select.view.js +132 -116
- package/dist/components/sidenav/SideNav.client.js +19 -18
- package/dist/components/sidenav/SideNav.server.js +8 -1
- package/dist/components/sidenav/SideNav.view.js +21 -3
- package/dist/components/skeleton/Skeleton.effects.client.js +3 -1
- package/dist/components/slider/Slider.client.js +56 -38
- package/dist/components/slider/Slider.view.js +1 -7
- package/dist/components/snackbar/SnackbarProvider.client.js +21 -22
- package/dist/components/stepper/Stepper.client.js +1 -8
- package/dist/components/switch/Switch.client.js +1 -6
- package/dist/components/switch/Switch.server.js +1 -3
- package/dist/components/table/Table.js +3 -1
- package/dist/components/table/TableCell.js +13 -1
- package/dist/components/teaser/Teaser.js +1 -5
- package/dist/constants/project.js +1 -1
- package/dist/helpers/createIsland.js +3 -1
- package/dist/helpers/createLazyWrapper.js +3 -1
- package/dist/helpers/date.js +21 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/accordion/Accordion.model.d.ts +1 -1
- package/dist/types/components/animated/Animated.client.d.ts +2 -2
- package/dist/types/components/animated/Animated.model.d.ts +1 -1
- package/dist/types/components/button/Button.client.d.ts +1 -1
- package/dist/types/components/button/Button.d.ts +1 -1
- package/dist/types/components/button/Button.lazy.d.ts +1 -1
- package/dist/types/components/button/Button.server.d.ts +1 -1
- package/dist/types/components/button/Button.view.d.ts +1 -1
- package/dist/types/components/card/Card.effects.client.d.ts +1 -1
- package/dist/types/components/card/index.d.ts +1 -1
- package/dist/types/components/carousel/Carousel.d.ts +3 -0
- package/dist/types/components/carousel/Carousel.lazy.d.ts +3 -0
- package/dist/types/components/carousel/Carousel.model.d.ts +4 -0
- package/dist/types/components/dialog/Dialog.client.d.ts +1 -1
- package/dist/types/components/dialog/Dialog.model.d.ts +4 -4
- package/dist/types/components/dialog/Dialog.view.d.ts +2 -2
- package/dist/types/components/drawer/Drawer.client.d.ts +1 -1
- package/dist/types/components/drawer/Drawer.d.ts +1 -1
- package/dist/types/components/drawer/Drawer.effects.client.d.ts +1 -1
- package/dist/types/components/drawer/Drawer.lazy.d.ts +1 -1
- package/dist/types/components/drawer/Drawer.model.d.ts +6 -6
- package/dist/types/components/drawer/Drawer.server.d.ts +1 -1
- package/dist/types/components/drawer/Drawer.view.d.ts +2 -2
- package/dist/types/components/drawer/index.d.ts +1 -1
- package/dist/types/components/icon/IconList.d.ts +1 -1
- package/dist/types/components/icon/index.d.ts +1 -1
- package/dist/types/components/image/Image.model.d.ts +2 -2
- package/dist/types/components/link/Link.d.ts +1 -1
- package/dist/types/components/link/Link.model.d.ts +1 -1
- package/dist/types/components/link/Link.server.d.ts +1 -1
- package/dist/types/components/loading/index.d.ts +1 -1
- package/dist/types/components/post-item/PostItem.client.d.ts +4 -0
- package/dist/types/components/post-item/PostItem.d.ts +3 -2
- package/dist/types/components/post-item/PostItem.lazy.d.ts +5 -0
- package/dist/types/components/post-item/PostItem.model.d.ts +46 -6
- package/dist/types/components/post-item/PostItem.server.d.ts +3 -0
- package/dist/types/components/post-item/PostItem.view.d.ts +3 -0
- package/dist/types/components/post-item/PostItemAuthor.model.d.ts +5 -8
- package/dist/types/components/post-item/index.d.ts +2 -2
- package/dist/types/components/post-teaser/PostTeaser.client.d.ts +4 -0
- package/dist/types/components/post-teaser/PostTeaser.d.ts +3 -2
- package/dist/types/components/post-teaser/PostTeaser.lazy.d.ts +5 -0
- package/dist/types/components/post-teaser/PostTeaser.model.d.ts +49 -3
- package/dist/types/components/post-teaser/PostTeaser.server.d.ts +3 -0
- package/dist/types/components/post-teaser/PostTeaser.view.d.ts +3 -0
- package/dist/types/components/post-teaser/index.d.ts +1 -1
- package/dist/types/components/post-widget/PostWidget.client.d.ts +4 -0
- package/dist/types/components/post-widget/PostWidget.d.ts +13 -3
- package/dist/types/components/post-widget/PostWidget.lazy.d.ts +14 -0
- package/dist/types/components/post-widget/PostWidget.model.d.ts +53 -3
- package/dist/types/components/post-widget/PostWidget.server.d.ts +3 -0
- package/dist/types/components/post-widget/PostWidget.view.d.ts +3 -0
- package/dist/types/components/post-widget/index.d.ts +1 -1
- package/dist/types/components/post-widget-carousel/PostWidgetCarousel.client.d.ts +3 -0
- package/dist/types/components/post-widget-carousel/PostWidgetCarousel.d.ts +11 -3
- package/dist/types/components/post-widget-carousel/PostWidgetCarousel.lazy.d.ts +12 -0
- package/dist/types/components/post-widget-carousel/PostWidgetCarousel.model.d.ts +39 -0
- package/dist/types/components/post-widget-carousel/PostWidgetCarousel.server.d.ts +3 -0
- package/dist/types/components/post-widget-carousel/PostWidgetCarousel.view.d.ts +3 -0
- package/dist/types/components/post-widget-carousel/index.d.ts +1 -1
- package/dist/types/components/sidenav/index.d.ts +1 -1
- package/dist/types/components/skeleton/Skeleton.effects.client.d.ts +2 -2
- package/dist/types/helpers/createIsland.d.ts +1 -1
- package/dist/types/helpers/createLazyWrapper.d.ts +1 -1
- package/dist/types/helpers/date.d.ts +5 -0
- package/dist/ui.css +116 -35
- package/package.json +3 -2
|
@@ -1,141 +1,12 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import { Button } from "../button/Button.js";
|
|
11
|
-
import { Grid } from "../grid/Grid.js";
|
|
12
|
-
import { GridRow } from "../grid/GridRow.js";
|
|
13
|
-
import { Animated } from "../animated/Animated.js";
|
|
14
|
-
import { Headline } from "../headline/Headline.js";
|
|
15
|
-
import { RichText } from "../rich-text/RichText.js";
|
|
16
|
-
import { Card } from "../card/Card.js";
|
|
17
|
-
import { Skeleton } from "../skeleton/Skeleton.js";
|
|
18
|
-
const bem = create(styles, "PostItem");
|
|
19
|
-
const PostItem = memo(
|
|
20
|
-
({
|
|
21
|
-
className,
|
|
22
|
-
readCount = 0,
|
|
23
|
-
title,
|
|
24
|
-
content,
|
|
25
|
-
category,
|
|
26
|
-
author,
|
|
27
|
-
date,
|
|
28
|
-
metaDate,
|
|
29
|
-
image,
|
|
30
|
-
button,
|
|
31
|
-
imageComponent: ImageComponent
|
|
32
|
-
}) => {
|
|
33
|
-
const wordCount = calculateWordCount(content);
|
|
34
|
-
const [imageLoaded, setImageLoaded] = useState(!ImageComponent);
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (!ImageComponent) setImageLoaded(true);
|
|
37
|
-
}, [ImageComponent]);
|
|
38
|
-
return /* @__PURE__ */ jsxs(
|
|
39
|
-
"article",
|
|
40
|
-
{
|
|
41
|
-
itemScope: true,
|
|
42
|
-
className: bem(void 0, void 0, className),
|
|
43
|
-
itemType: "http://schema.org/BlogPosting",
|
|
44
|
-
children: [
|
|
45
|
-
/* @__PURE__ */ jsxs(Grid, { className: bem("grid"), children: [
|
|
46
|
-
/* @__PURE__ */ jsx(GridRow, { className: bem("content"), md: image ? 8 : 12, xs: 12, children: /* @__PURE__ */ jsxs(Animated, { className: bem("animation"), children: [
|
|
47
|
-
/* @__PURE__ */ jsxs("header", { children: [
|
|
48
|
-
/* @__PURE__ */ jsx(
|
|
49
|
-
Headline,
|
|
50
|
-
{
|
|
51
|
-
className: bem("headline", void 0, title == null ? void 0 : title.className),
|
|
52
|
-
size: "lg",
|
|
53
|
-
type: "h2",
|
|
54
|
-
...title,
|
|
55
|
-
children: title.content
|
|
56
|
-
}
|
|
57
|
-
),
|
|
58
|
-
/* @__PURE__ */ jsxs("div", { className: bem("info"), children: [
|
|
59
|
-
author && /* @__PURE__ */ jsx(PostItemAuthor, { avatar: author.avatar, name: author.name }),
|
|
60
|
-
isString(date) && /* @__PURE__ */ jsxs(
|
|
61
|
-
"p",
|
|
62
|
-
{
|
|
63
|
-
"aria-label": `Published at ${date}`,
|
|
64
|
-
className: bem("date"),
|
|
65
|
-
itemProp: "datePublished",
|
|
66
|
-
children: [
|
|
67
|
-
"📅 ",
|
|
68
|
-
/* @__PURE__ */ jsx("time", { dateTime: metaDate, itemProp: "datePublished", children: date })
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
),
|
|
72
|
-
readCount > 0 && /* @__PURE__ */ jsxs(
|
|
73
|
-
"div",
|
|
74
|
-
{
|
|
75
|
-
itemScope: true,
|
|
76
|
-
className: bem("read__count"),
|
|
77
|
-
itemProp: "interactionStatistic",
|
|
78
|
-
itemType: "https://schema.org/InteractionCounter",
|
|
79
|
-
children: [
|
|
80
|
-
/* @__PURE__ */ jsx(
|
|
81
|
-
"meta",
|
|
82
|
-
{
|
|
83
|
-
content: "https://schema.org/ReadAction",
|
|
84
|
-
itemProp: "interactionType"
|
|
85
|
-
}
|
|
86
|
-
),
|
|
87
|
-
/* @__PURE__ */ jsx("span", { itemProp: "userInteractionCount", children: readCount })
|
|
88
|
-
]
|
|
89
|
-
}
|
|
90
|
-
)
|
|
91
|
-
] })
|
|
92
|
-
] }),
|
|
93
|
-
isString(content) && /* @__PURE__ */ jsx("div", { itemProp: "articleBody", children: /* @__PURE__ */ jsx(RichText, { className: bem("content__paragraph"), children: content }) }),
|
|
94
|
-
button && /* @__PURE__ */ jsx(
|
|
95
|
-
Button,
|
|
96
|
-
{
|
|
97
|
-
variant: "outlined",
|
|
98
|
-
...button,
|
|
99
|
-
className: bem("button", void 0, button == null ? void 0 : button.className),
|
|
100
|
-
contentClassName: bem(
|
|
101
|
-
"button__content",
|
|
102
|
-
void 0,
|
|
103
|
-
button == null ? void 0 : button.contentClassName
|
|
104
|
-
)
|
|
105
|
-
}
|
|
106
|
-
)
|
|
107
|
-
] }) }),
|
|
108
|
-
/* @__PURE__ */ jsx(GridRow, { md: 4, xs: 12, children: /* @__PURE__ */ jsxs(
|
|
109
|
-
Card,
|
|
110
|
-
{
|
|
111
|
-
enableShadow: true,
|
|
112
|
-
background: image == null ? void 0 : image.src,
|
|
113
|
-
className: bem("image__wrapper"),
|
|
114
|
-
contentClassName: bem("image__content__wrapper"),
|
|
115
|
-
redirect: button == null ? void 0 : button.redirect,
|
|
116
|
-
children: [
|
|
117
|
-
!imageLoaded && /* @__PURE__ */ jsx(Skeleton, { height: "275px" }),
|
|
118
|
-
ImageComponent !== void 0 && isString(image == null ? void 0 : image.src) && /* @__PURE__ */ jsx(
|
|
119
|
-
ImageComponent,
|
|
120
|
-
{
|
|
121
|
-
...image,
|
|
122
|
-
className: bem("image"),
|
|
123
|
-
sizes: "(max-width: 960px) 100vw, 25vw",
|
|
124
|
-
onLoad: /* @__PURE__ */ __name(() => setImageLoaded(true), "onLoad")
|
|
125
|
-
}
|
|
126
|
-
)
|
|
127
|
-
]
|
|
128
|
-
}
|
|
129
|
-
) })
|
|
130
|
-
] }),
|
|
131
|
-
wordCount > 0 && /* @__PURE__ */ jsx("meta", { content: String(wordCount), itemProp: "wordCount" }),
|
|
132
|
-
isString(category) && /* @__PURE__ */ jsx("meta", { content: category, itemProp: "articleSection" })
|
|
133
|
-
]
|
|
134
|
-
}
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
);
|
|
138
|
-
PostItem.displayName = "PostItem";
|
|
3
|
+
import { createIsland } from "../../helpers/createIsland.js";
|
|
4
|
+
import PostItemServer from "./PostItem.server.js";
|
|
5
|
+
const PostItem = createIsland({
|
|
6
|
+
name: "PostItem",
|
|
7
|
+
Server: PostItemServer,
|
|
8
|
+
loadLazy: /* @__PURE__ */ __name(() => import("./PostItem.lazy.js"), "loadLazy")
|
|
9
|
+
});
|
|
139
10
|
export {
|
|
140
11
|
PostItem
|
|
141
12
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createLazyWrapper } from "../../helpers/createLazyWrapper.js";
|
|
3
|
+
import PostItemClient from "./PostItem.client.js";
|
|
4
|
+
import PostItemServer from "./PostItem.server.js";
|
|
5
|
+
const PostItem_lazy = createLazyWrapper({
|
|
6
|
+
name: "PostItem",
|
|
7
|
+
Client: PostItemClient,
|
|
8
|
+
Server: PostItemServer,
|
|
9
|
+
// Hydrate when visible if interactive (e.g., button.onClick, redirect, etc.)
|
|
10
|
+
hydrateOnVisible: true
|
|
11
|
+
});
|
|
12
|
+
export {
|
|
13
|
+
PostItem_lazy as default
|
|
14
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const styles = {
|
|
2
2
|
"prokodo-PostItem__grid": "prokodo-PostItem__grid",
|
|
3
|
+
"prokodo-PostItem__media": "prokodo-PostItem__media",
|
|
4
|
+
"prokodo-PostItem__main": "prokodo-PostItem__main",
|
|
3
5
|
"prokodo-PostItem__animation": "prokodo-PostItem__animation",
|
|
4
6
|
"prokodo-PostItem__headline": "prokodo-PostItem__headline",
|
|
5
7
|
"prokodo-PostItem__info": "prokodo-PostItem__info",
|
|
@@ -8,8 +10,8 @@ const styles = {
|
|
|
8
10
|
"prokodo-PostItem__content": "prokodo-PostItem__content",
|
|
9
11
|
"prokodo-PostItem__content__paragraph": "prokodo-PostItem__content__paragraph",
|
|
10
12
|
"prokodo-PostItem__image": "prokodo-PostItem__image",
|
|
11
|
-
"prokodo-PostItem__image__wrapper": "prokodo-PostItem__image__wrapper",
|
|
12
13
|
"prokodo-PostItem__image__content__wrapper": "prokodo-PostItem__image__content__wrapper",
|
|
14
|
+
"prokodo-PostItem__image__wrapper": "prokodo-PostItem__image__wrapper",
|
|
13
15
|
"prokodo-PostItem__button": "prokodo-PostItem__button",
|
|
14
16
|
"prokodo-PostItem__button__content": "prokodo-PostItem__button__content"
|
|
15
17
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { calculateWordCount } from "../../helpers/calculation.js";
|
|
5
|
+
import { PostItemView } from "./PostItem.view.js";
|
|
6
|
+
function PostItemServer(p) {
|
|
7
|
+
const { content, readingWpm = 200 } = p;
|
|
8
|
+
const wordCount = calculateWordCount(content);
|
|
9
|
+
const readMinutes = wordCount > 0 ? Math.max(1, Math.ceil(wordCount / readingWpm)) : 0;
|
|
10
|
+
return /* @__PURE__ */ jsx(PostItemView, { ...p, readMinutes, wordCount });
|
|
11
|
+
}
|
|
12
|
+
__name(PostItemServer, "PostItemServer");
|
|
13
|
+
export {
|
|
14
|
+
PostItemServer as default
|
|
15
|
+
};
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
4
|
+
import { create } from "../../helpers/bem.js";
|
|
5
|
+
import { localizeDate } from "../../helpers/date.js";
|
|
6
|
+
import { isString } from "../../helpers/validations.js";
|
|
7
|
+
import styles from "./PostItem.module.scss.js";
|
|
8
|
+
import { PostItemAuthor } from "./PostItemAuthor.js";
|
|
9
|
+
import { Button } from "../button/Button.js";
|
|
10
|
+
import { Animated } from "../animated/Animated.js";
|
|
11
|
+
import { Headline } from "../headline/Headline.js";
|
|
12
|
+
import { RichText } from "../rich-text/RichText.js";
|
|
13
|
+
import { Card } from "../card/Card.js";
|
|
14
|
+
const bem = create(styles, "PostItem");
|
|
15
|
+
function PostItemView(props) {
|
|
16
|
+
var _a, _b, _c, _d, _e, _f;
|
|
17
|
+
const {
|
|
18
|
+
locale,
|
|
19
|
+
className,
|
|
20
|
+
classes,
|
|
21
|
+
componentsProps,
|
|
22
|
+
readCount = 0,
|
|
23
|
+
title,
|
|
24
|
+
content,
|
|
25
|
+
category,
|
|
26
|
+
author,
|
|
27
|
+
date,
|
|
28
|
+
image,
|
|
29
|
+
button,
|
|
30
|
+
// private from client/server wrappers
|
|
31
|
+
wordCount,
|
|
32
|
+
readMinutes,
|
|
33
|
+
// public opts
|
|
34
|
+
structuredData = true,
|
|
35
|
+
animate = true,
|
|
36
|
+
...rest
|
|
37
|
+
} = props;
|
|
38
|
+
const cardMerged = {
|
|
39
|
+
...componentsProps == null ? void 0 : componentsProps.card,
|
|
40
|
+
...rest,
|
|
41
|
+
// keep variant narrow; if none is provided, let Card default handle it
|
|
42
|
+
variant: ((_a = componentsProps == null ? void 0 : componentsProps.card) == null ? void 0 : _a.variant) ?? (rest == null ? void 0 : rest.variant) ?? void 0
|
|
43
|
+
};
|
|
44
|
+
const ArticleWrapper = animate ? Animated : ({
|
|
45
|
+
children,
|
|
46
|
+
className: className2
|
|
47
|
+
}) => /* @__PURE__ */ jsx("div", { className: className2, children });
|
|
48
|
+
let formattedDate;
|
|
49
|
+
if (isString(date)) {
|
|
50
|
+
formattedDate = localizeDate(locale ?? "en-GB", date);
|
|
51
|
+
}
|
|
52
|
+
return /* @__PURE__ */ jsxs(
|
|
53
|
+
"article",
|
|
54
|
+
{
|
|
55
|
+
itemScope: true,
|
|
56
|
+
className: bem(
|
|
57
|
+
void 0,
|
|
58
|
+
void 0,
|
|
59
|
+
[className, classes == null ? void 0 : classes.root].filter(Boolean).join(" ")
|
|
60
|
+
),
|
|
61
|
+
itemType: "https://schema.org/BlogPosting\n",
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ jsxs("div", { className: bem("grid", void 0, classes == null ? void 0 : classes.grid), children: [
|
|
64
|
+
/* @__PURE__ */ jsx("div", { className: bem("main", void 0, classes == null ? void 0 : classes.main), children: /* @__PURE__ */ jsxs(
|
|
65
|
+
ArticleWrapper,
|
|
66
|
+
{
|
|
67
|
+
className: bem("animation", void 0, classes == null ? void 0 : classes.animation),
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ jsxs("header", { children: [
|
|
70
|
+
/* @__PURE__ */ jsx(
|
|
71
|
+
Headline,
|
|
72
|
+
{
|
|
73
|
+
...{ ...title, ...(componentsProps == null ? void 0 : componentsProps.headline) ?? {} },
|
|
74
|
+
size: (title == null ? void 0 : title.size) ?? ((_b = componentsProps == null ? void 0 : componentsProps.headline) == null ? void 0 : _b.size) ?? "md",
|
|
75
|
+
type: (title == null ? void 0 : title.type) ?? ((_c = componentsProps == null ? void 0 : componentsProps.headline) == null ? void 0 : _c.type) ?? "h2",
|
|
76
|
+
className: bem(
|
|
77
|
+
"headline",
|
|
78
|
+
void 0,
|
|
79
|
+
[
|
|
80
|
+
title == null ? void 0 : title.className,
|
|
81
|
+
(_d = componentsProps == null ? void 0 : componentsProps.headline) == null ? void 0 : _d.className,
|
|
82
|
+
classes == null ? void 0 : classes.headline
|
|
83
|
+
].filter(Boolean).join(" ")
|
|
84
|
+
),
|
|
85
|
+
children: title.content
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ jsxs("div", { className: bem("info", void 0, classes == null ? void 0 : classes.info), children: [
|
|
89
|
+
author && /* @__PURE__ */ jsx(
|
|
90
|
+
PostItemAuthor,
|
|
91
|
+
{
|
|
92
|
+
...author,
|
|
93
|
+
...(componentsProps == null ? void 0 : componentsProps.author) ?? {},
|
|
94
|
+
avatar: author.avatar,
|
|
95
|
+
name: author.name
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
isString(formattedDate == null ? void 0 : formattedDate.locale) && /* @__PURE__ */ jsx(
|
|
99
|
+
"p",
|
|
100
|
+
{
|
|
101
|
+
"aria-label": `Published on ${formattedDate == null ? void 0 : formattedDate.locale}`,
|
|
102
|
+
className: bem("date", void 0, classes == null ? void 0 : classes.date),
|
|
103
|
+
children: /* @__PURE__ */ jsx(
|
|
104
|
+
"time",
|
|
105
|
+
{
|
|
106
|
+
dateTime: formattedDate == null ? void 0 : formattedDate.meta,
|
|
107
|
+
itemProp: "datePublished",
|
|
108
|
+
children: formattedDate == null ? void 0 : formattedDate.locale
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
readMinutes > 0 && /* @__PURE__ */ jsxs(
|
|
114
|
+
"p",
|
|
115
|
+
{
|
|
116
|
+
"aria-label": `${readMinutes} min read`,
|
|
117
|
+
className: bem(
|
|
118
|
+
"reading__time",
|
|
119
|
+
void 0,
|
|
120
|
+
classes == null ? void 0 : classes.readingTime
|
|
121
|
+
),
|
|
122
|
+
children: [
|
|
123
|
+
"· ",
|
|
124
|
+
readMinutes,
|
|
125
|
+
" min read"
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
readCount > 0 && /* @__PURE__ */ jsxs(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
itemScope: true,
|
|
133
|
+
"aria-label": `${readCount} reads`,
|
|
134
|
+
itemProp: "interactionStatistic",
|
|
135
|
+
itemType: "https://schema.org/InteractionCounter",
|
|
136
|
+
className: bem(
|
|
137
|
+
"read__count",
|
|
138
|
+
void 0,
|
|
139
|
+
classes == null ? void 0 : classes.readCount
|
|
140
|
+
),
|
|
141
|
+
children: [
|
|
142
|
+
/* @__PURE__ */ jsx(
|
|
143
|
+
"meta",
|
|
144
|
+
{
|
|
145
|
+
content: "https://schema.org/ReadAction",
|
|
146
|
+
itemProp: "interactionType"
|
|
147
|
+
}
|
|
148
|
+
),
|
|
149
|
+
/* @__PURE__ */ jsx("span", { itemProp: "userInteractionCount", children: readCount })
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
] })
|
|
154
|
+
] }),
|
|
155
|
+
isString(content) && /* @__PURE__ */ jsx("div", { itemProp: "articleBody", children: /* @__PURE__ */ jsx(
|
|
156
|
+
RichText,
|
|
157
|
+
{
|
|
158
|
+
className: bem(
|
|
159
|
+
"content__paragraph",
|
|
160
|
+
void 0,
|
|
161
|
+
classes == null ? void 0 : classes.contentParagraph
|
|
162
|
+
),
|
|
163
|
+
children: content
|
|
164
|
+
}
|
|
165
|
+
) }),
|
|
166
|
+
button && /* @__PURE__ */ jsx(
|
|
167
|
+
Button,
|
|
168
|
+
{
|
|
169
|
+
...{ ...button, ...(componentsProps == null ? void 0 : componentsProps.button) ?? {} },
|
|
170
|
+
className: bem(
|
|
171
|
+
"button",
|
|
172
|
+
void 0,
|
|
173
|
+
[
|
|
174
|
+
button == null ? void 0 : button.className,
|
|
175
|
+
(_e = componentsProps == null ? void 0 : componentsProps.button) == null ? void 0 : _e.className,
|
|
176
|
+
classes == null ? void 0 : classes.button
|
|
177
|
+
].filter(Boolean).join(" ")
|
|
178
|
+
),
|
|
179
|
+
contentClassName: bem(
|
|
180
|
+
"button__content",
|
|
181
|
+
void 0,
|
|
182
|
+
[button == null ? void 0 : button.contentClassName, classes == null ? void 0 : classes.buttonContent].filter(Boolean).join(" ")
|
|
183
|
+
),
|
|
184
|
+
variant: (button == null ? void 0 : button.variant) ?? ((_f = componentsProps == null ? void 0 : componentsProps.button) == null ? void 0 : _f.variant) ?? "outlined"
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
) }),
|
|
190
|
+
isString(image) && /* @__PURE__ */ jsx("aside", { className: bem("media", void 0, classes == null ? void 0 : classes.media), children: /* @__PURE__ */ jsx(
|
|
191
|
+
Card,
|
|
192
|
+
{
|
|
193
|
+
...cardMerged,
|
|
194
|
+
background: image,
|
|
195
|
+
enableShadow: cardMerged.enableShadow ?? true,
|
|
196
|
+
redirect: button == null ? void 0 : button.redirect,
|
|
197
|
+
className: bem(
|
|
198
|
+
"image__wrapper",
|
|
199
|
+
void 0,
|
|
200
|
+
classes == null ? void 0 : classes.imageWrapper
|
|
201
|
+
),
|
|
202
|
+
contentClassName: bem(
|
|
203
|
+
"image__content__wrapper",
|
|
204
|
+
void 0,
|
|
205
|
+
classes == null ? void 0 : classes.imageContentWrapper
|
|
206
|
+
),
|
|
207
|
+
children: /* @__PURE__ */ jsx(Fragment, {})
|
|
208
|
+
}
|
|
209
|
+
) })
|
|
210
|
+
] }),
|
|
211
|
+
wordCount > 0 && /* @__PURE__ */ jsx("meta", { content: String(wordCount), itemProp: "wordCount" }),
|
|
212
|
+
isString(category) && /* @__PURE__ */ jsx("meta", { content: category, itemProp: "articleSection" }),
|
|
213
|
+
Boolean(structuredData) && /* @__PURE__ */ jsx(
|
|
214
|
+
"script",
|
|
215
|
+
{
|
|
216
|
+
type: "application/ld+json",
|
|
217
|
+
dangerouslySetInnerHTML: {
|
|
218
|
+
__html: JSON.stringify({
|
|
219
|
+
"@context": "https://schema.org",
|
|
220
|
+
"@type": "BlogPosting",
|
|
221
|
+
headline: title == null ? void 0 : title.content,
|
|
222
|
+
datePublished: isString(formattedDate == null ? void 0 : formattedDate.meta) ? formattedDate == null ? void 0 : formattedDate.meta : void 0,
|
|
223
|
+
articleSection: category,
|
|
224
|
+
wordCount,
|
|
225
|
+
author: isString(author == null ? void 0 : author.name) ? { "@type": "Person", name: author == null ? void 0 : author.name } : void 0,
|
|
226
|
+
image: isString(image) ? [image] : void 0
|
|
227
|
+
})
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
)
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
__name(PostItemView, "PostItemView");
|
|
236
|
+
export {
|
|
237
|
+
PostItemView
|
|
238
|
+
};
|
|
@@ -8,28 +8,34 @@ const bem = create(styles, "PostItemAuthor");
|
|
|
8
8
|
const PostItemAuthor = memo(
|
|
9
9
|
({ className, avatar, avatarProps, name, nameProps }) => {
|
|
10
10
|
const authorName = name;
|
|
11
|
-
return /* @__PURE__ */ jsxs(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
11
|
+
return /* @__PURE__ */ jsxs(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
itemScope: true,
|
|
15
|
+
className: bem(void 0, void 0, className),
|
|
16
|
+
itemProp: "author",
|
|
17
|
+
itemType: "https://schema.org/Person",
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ jsx(
|
|
20
|
+
Avatar,
|
|
21
|
+
{
|
|
22
|
+
image: (avatar == null ? void 0 : avatar.src) !== void 0 && isString(avatar == null ? void 0 : avatar.src) ? { src: avatar == null ? void 0 : avatar.src, alt: (avatar == null ? void 0 : avatar.alt) ?? authorName ?? "" } : void 0,
|
|
23
|
+
...avatarProps
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
/* @__PURE__ */ jsx(
|
|
27
|
+
"p",
|
|
28
|
+
{
|
|
29
|
+
"aria-label": `Author ${authorName}`,
|
|
30
|
+
...nameProps,
|
|
31
|
+
className: bem("name", void 0, nameProps == null ? void 0 : nameProps.className),
|
|
32
|
+
itemProp: "name",
|
|
33
|
+
children: authorName
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
);
|
|
33
39
|
}
|
|
34
40
|
);
|
|
35
41
|
PostItemAuthor.displayName = "PostItemAuthor";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { memo, useMemo, useState, useCallback } from "react";
|
|
4
|
+
import { calculateWordCount } from "../../helpers/calculation.js";
|
|
5
|
+
import { PostTeaserView } from "./PostTeaser.view.js";
|
|
6
|
+
const PostTeaserClient = memo((props) => {
|
|
7
|
+
const { content, readingWpm = 200 } = props;
|
|
8
|
+
const wordCount = useMemo(() => calculateWordCount(content), [content]);
|
|
9
|
+
const readMinutes = useMemo(
|
|
10
|
+
() => wordCount > 0 ? Math.max(1, Math.ceil(wordCount / readingWpm)) : 0,
|
|
11
|
+
[wordCount, readingWpm]
|
|
12
|
+
);
|
|
13
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
14
|
+
const handleMouseEnter = useCallback(() => setIsHovered(true), []);
|
|
15
|
+
const handleMouseLeave = useCallback(() => setIsHovered(false), []);
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
PostTeaserView,
|
|
18
|
+
{
|
|
19
|
+
...props,
|
|
20
|
+
isHovered,
|
|
21
|
+
readMinutes,
|
|
22
|
+
wordCount,
|
|
23
|
+
onMouseEnter: handleMouseEnter,
|
|
24
|
+
onMouseLeave: handleMouseLeave
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
PostTeaserClient.displayName = "PostTeaserClient";
|
|
29
|
+
export {
|
|
30
|
+
PostTeaserClient as default
|
|
31
|
+
};
|