@levo-so/blocks 0.1.75 → 0.1.76
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/package.json +4 -4
- package/src/blocks/about-us/about-us-1.schema.ts +0 -3
- package/src/blocks/blogs/ClientOnly.tsx +24 -0
- package/src/blocks/blogs/blog-listing-1.schema.ts +750 -111
- package/src/blocks/blogs/blog-listing-1.tsx +123 -41
- package/src/blocks/blogs/blog-listing-2.schema.ts +1127 -2640
- package/src/blocks/blogs/blog-listing-2.tsx +110 -23
- package/src/blocks/blogs/blog-listing-3.schema.ts +713 -2010
- package/src/blocks/blogs/blog-listing-3.tsx +118 -20
- package/src/blocks/blogs/blog-post-1.schema.ts +262 -32
- package/src/blocks/blogs/blog-post-1.tsx +217 -28
- package/src/blocks/cards/cards-16.schema.ts +947 -0
- package/src/blocks/cards/cards-16.tsx +106 -0
- package/src/blocks/cards/cards-17.schema.ts +1945 -0
- package/src/blocks/cards/cards-17.tsx +112 -0
- package/src/blocks/cards/cards-18.schema.ts +1040 -0
- package/src/blocks/cards/cards-18.tsx +102 -0
- package/src/blocks/cards/cards-2.schema.ts +2 -2
- package/src/blocks/cards/cards-3.schema.ts +3 -16
- package/src/blocks/cards/cards-4.schema.ts +3 -28
- package/src/blocks/cards/cards-7.schema.ts +4 -7
- package/src/blocks/cards/cards-8.schema.ts +1 -10
- package/src/blocks/carousel/carousel-2.schema.ts +1 -2
- package/src/blocks/content/content-10.schema.ts +450 -0
- package/src/blocks/content/content-10.tsx +43 -0
- package/src/blocks/content/content-3.schema.ts +22 -28
- package/src/blocks/content/content-5.schema.ts +0 -4
- package/src/blocks/cta/cta-1.schema.ts +0 -3
- package/src/blocks/event/event-details.schema.ts +41 -175
- package/src/blocks/event/event-details.tsx +45 -50
- package/src/blocks/event/event-listing-2.schema.ts +437 -202
- package/src/blocks/event/event-listing-2.tsx +86 -22
- package/src/blocks/event/event-listing-3.schema.ts +232 -196
- package/src/blocks/event/event-listing-3.tsx +62 -29
- package/src/blocks/event/event-listing-4.schema.ts +314 -2824
- package/src/blocks/event/event-listing-4.tsx +68 -32
- package/src/blocks/event/event-listing.schema.ts +176 -1032
- package/src/blocks/event/event-listing.tsx +59 -25
- package/src/blocks/features/features-1/variants/stylized-cards-v2.ts +0 -1
- package/src/blocks/features/features-4.schema.ts +4 -14
- package/src/blocks/features/features-5.schema.ts +30 -51
- package/src/blocks/features/features-6.schema.ts +0 -1
- package/src/blocks/filter-listing/filter-listing-1.schema.ts +1 -3
- package/src/blocks/footer/footer-3.schema.ts +6 -14
- package/src/blocks/hero/hero-11.schema.ts +25 -54
- package/src/blocks/hero/hero-5.schema.ts +2 -6
- package/src/blocks/hero/hero-6.schema.ts +1 -10
- package/src/blocks/index.ts +4 -0
- package/src/blocks/logos/logos-1.schema.ts +0 -30
- package/src/blocks/pricing/pricing-1.schema.ts +0 -3
- package/src/blocks/stats/variants/default.ts +4 -5
- package/src/blocks/team/team-2.schema.ts +57 -154
- package/src/blocks/team/team-3.schema.ts +14 -31
- package/src/blocks/testimonial/testimonial-4.schema.ts +67 -152
- package/src/blocks/testimonial/testimonial-5/variants/default.ts +0 -1
- package/src/blocks/testimonial/testimonial-5/variants/testimonialWithLogo.ts +0 -1
- package/src/blocks/testimonial/testimonial-5/variants/testimonialWithRatings.ts +0 -1
- package/src/schemas/blocks.ts +8 -0
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import type { IModuleStudioConfig, IPost } from "@levo-so/core";
|
|
1
2
|
import {
|
|
3
|
+
Avatar,
|
|
4
|
+
AvatarFallbackV2,
|
|
5
|
+
AvatarImageV2,
|
|
2
6
|
Box,
|
|
3
7
|
Button,
|
|
4
8
|
Container,
|
|
@@ -8,67 +12,145 @@ import {
|
|
|
8
12
|
Image,
|
|
9
13
|
Section,
|
|
10
14
|
Typography,
|
|
11
|
-
|
|
15
|
+
useBlockContext,
|
|
16
|
+
useContextEngine,
|
|
12
17
|
} from "@levo-so/studio";
|
|
13
18
|
import dayjs from "dayjs";
|
|
14
19
|
|
|
20
|
+
import { ClientOnly } from "../event/ClientOnly";
|
|
15
21
|
import type { IBlogListing1Content } from "./blog-listing-1.schema";
|
|
16
22
|
|
|
23
|
+
/** */
|
|
24
|
+
interface IBlogMeta {
|
|
25
|
+
total: number;
|
|
26
|
+
pages: number;
|
|
27
|
+
blog?: {
|
|
28
|
+
studio_config?: IModuleStudioConfig[];
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
17
32
|
const BlogListing1: React.FC<ILevoBlockBaseProps<IBlogListing1Content>> = ({ content }) => {
|
|
18
|
-
const {
|
|
33
|
+
const { response, query, setQuery } = useContextEngine<IPost, IBlogMeta>("blogs");
|
|
34
|
+
const { isBuilder } = useBlockContext();
|
|
19
35
|
|
|
20
36
|
const handleNext = () => setQuery({ page: (query?.page || 0) + 1 });
|
|
21
37
|
const handlePrevious = () => setQuery({ page: (query?.page || 0) - 1 });
|
|
22
38
|
|
|
39
|
+
const studioConfig = response?.meta?.blog?.studio_config?.find((item) => !item.block_instance_id);
|
|
40
|
+
|
|
23
41
|
return (
|
|
24
42
|
<Section elementKey="layout">
|
|
25
43
|
<Container elementKey="container">
|
|
26
|
-
<Box elementKey="
|
|
27
|
-
<
|
|
28
|
-
|
|
44
|
+
<Box elementKey="header">
|
|
45
|
+
<Box elementKey="text_wrapper">
|
|
46
|
+
<Heading elementKey="title" />
|
|
47
|
+
<Typography elementKey="description" />
|
|
48
|
+
</Box>
|
|
49
|
+
<Box elementKey="ctas_levoGroup" data-levo_group>
|
|
50
|
+
{content?.ctas?.map((v, index) => {
|
|
51
|
+
return (
|
|
52
|
+
<Button
|
|
53
|
+
elementKey={`ctas.${index}.cta`}
|
|
54
|
+
key={`ctas.${index}.cta`}
|
|
55
|
+
data-levo_group_item
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
})}
|
|
59
|
+
</Box>
|
|
29
60
|
</Box>
|
|
30
61
|
<Box elementKey="blogs_levoGroup" data-levo_group>
|
|
31
|
-
{data
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
62
|
+
{response?.data?.map((item, index) => {
|
|
63
|
+
return (
|
|
64
|
+
<Box
|
|
65
|
+
data-levo_group_item
|
|
66
|
+
key={index}
|
|
67
|
+
elementKey={`blogs.${index}.blog`}
|
|
68
|
+
config={
|
|
69
|
+
(isBuilder && studioConfig?.preview_url) || (!isBuilder && studioConfig?.live_url)
|
|
70
|
+
? {
|
|
71
|
+
action: {
|
|
72
|
+
type: "external_link",
|
|
73
|
+
value:
|
|
74
|
+
isBuilder && studioConfig.preview_url
|
|
75
|
+
? studioConfig.preview_url.replace(/\{[^}]+\}/g, item?.slug)
|
|
76
|
+
: !isBuilder && studioConfig.live_url
|
|
77
|
+
? studioConfig.live_url.replace(/\{[^}]+\}/g, item?.slug)
|
|
78
|
+
: "",
|
|
79
|
+
options: {},
|
|
80
|
+
},
|
|
81
|
+
}
|
|
82
|
+
: {}
|
|
83
|
+
}
|
|
84
|
+
>
|
|
85
|
+
<Image
|
|
86
|
+
alt="cover_image"
|
|
87
|
+
elementKey={`blogs.${index}.cover_image`}
|
|
88
|
+
image={item?.cover_image ?? undefined}
|
|
89
|
+
/>
|
|
52
90
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
91
|
+
<Box elementKey={`blogs.${index}.blog_content_wrapper`}>
|
|
92
|
+
<Box elementKey={`blogs.${index}.text_content_wrapper`}>
|
|
93
|
+
<Box elementKey={`blogs.${index}.content_header`}>
|
|
94
|
+
{item?.published_at && dayjs(item?.published_at).isValid() && (
|
|
95
|
+
<Box elementKey={`blogs.${index}.timestamp_wrapper`}>
|
|
96
|
+
<Icon elementKey={`blogs.${index}.timestamp_icon`} />
|
|
97
|
+
<ClientOnly>
|
|
98
|
+
<Typography elementKey={`blogs.${index}.timestamp`}>
|
|
99
|
+
{dayjs(item?.published_at).format("DD MMM, YYYY")}
|
|
100
|
+
</Typography>
|
|
101
|
+
</ClientOnly>
|
|
102
|
+
</Box>
|
|
103
|
+
)}
|
|
104
|
+
{item?.categories?.at(0)?.name && (
|
|
105
|
+
<Box elementKey={`blogs.${index}.category_wrapper`}>
|
|
106
|
+
<Icon elementKey={`blogs.${index}.category_icon`} />
|
|
107
|
+
<ClientOnly>
|
|
108
|
+
<Typography elementKey={`blogs.${index}.category`}>
|
|
109
|
+
{item?.categories?.at(0)?.name}
|
|
110
|
+
</Typography>
|
|
111
|
+
</ClientOnly>
|
|
62
112
|
</Box>
|
|
113
|
+
)}
|
|
114
|
+
</Box>
|
|
115
|
+
|
|
116
|
+
<Box elementKey={`blogs.${index}.blog_info_wrapper`}>
|
|
117
|
+
<Heading elementKey={`blogs.${index}.title`}>{item?.title}</Heading>
|
|
118
|
+
<Typography elementKey={`blogs.${index}.description`}>
|
|
119
|
+
{item?.summary}
|
|
120
|
+
</Typography>
|
|
121
|
+
</Box>
|
|
122
|
+
<Box elementKey={`blogs.${index}.author_wrapper`}>
|
|
123
|
+
<Avatar className="h-10 w-10">
|
|
124
|
+
<AvatarImageV2 src={item?.authors?.[0]?.profile_picture?.location} />
|
|
125
|
+
<AvatarFallbackV2>
|
|
126
|
+
{[item?.authors?.[0]?.first_name, item?.authors?.[0]?.last_name]
|
|
127
|
+
?.map((v) => v?.[0])
|
|
128
|
+
.filter(Boolean)
|
|
129
|
+
.join("")
|
|
130
|
+
.toUpperCase()}
|
|
131
|
+
</AvatarFallbackV2>
|
|
132
|
+
</Avatar>
|
|
133
|
+
<Box elementKey={`blogs.${index}.author_info_wrapper`}>
|
|
134
|
+
<Heading elementKey={`blogs.${index}.author_name`}>
|
|
135
|
+
{item?.authors?.[0]
|
|
136
|
+
? [item.authors[0].first_name, item.authors[0].last_name]
|
|
137
|
+
.filter(Boolean)
|
|
138
|
+
.join(" ")
|
|
139
|
+
: "Anonymous"}
|
|
140
|
+
</Heading>
|
|
141
|
+
<Typography elementKey={`blogs.${index}.author_description`}>
|
|
142
|
+
{item?.authors?.[0]?.bio || "Author"}
|
|
143
|
+
</Typography>
|
|
63
144
|
</Box>
|
|
64
145
|
</Box>
|
|
65
|
-
<Button elementKey={`blogs.${index}.cta`} />
|
|
66
146
|
</Box>
|
|
147
|
+
<Button elementKey={`blogs.${index}.cta`} />
|
|
67
148
|
</Box>
|
|
68
|
-
|
|
69
|
-
|
|
149
|
+
</Box>
|
|
150
|
+
);
|
|
151
|
+
})}
|
|
70
152
|
</Box>
|
|
71
|
-
{
|
|
153
|
+
{response?.meta && (
|
|
72
154
|
<Box elementKey="pagination-wrapper">
|
|
73
155
|
<Button
|
|
74
156
|
elementKey="pagination-left"
|
|
@@ -76,12 +158,12 @@ const BlogListing1: React.FC<ILevoBlockBaseProps<IBlogListing1Content>> = ({ con
|
|
|
76
158
|
onClick={handlePrevious}
|
|
77
159
|
/>
|
|
78
160
|
<Typography elementKey="pagination-text">
|
|
79
|
-
{`${query?.page || 0}/${meta?.pages || 0}`}
|
|
161
|
+
{`${query?.page || 0}/${response?.meta?.pages || 0}`}
|
|
80
162
|
</Typography>
|
|
81
163
|
<Button
|
|
82
164
|
elementKey="pagination-right"
|
|
83
165
|
onClick={handleNext}
|
|
84
|
-
disabled={query?.page === meta?.pages}
|
|
166
|
+
disabled={query?.page === response?.meta?.pages}
|
|
85
167
|
/>
|
|
86
168
|
</Box>
|
|
87
169
|
)}
|