@levo-so/blocks 0.1.74 → 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.
Files changed (58) hide show
  1. package/package.json +4 -4
  2. package/src/blocks/about-us/about-us-1.schema.ts +0 -3
  3. package/src/blocks/blogs/ClientOnly.tsx +24 -0
  4. package/src/blocks/blogs/blog-listing-1.schema.ts +750 -111
  5. package/src/blocks/blogs/blog-listing-1.tsx +123 -41
  6. package/src/blocks/blogs/blog-listing-2.schema.ts +1127 -2640
  7. package/src/blocks/blogs/blog-listing-2.tsx +110 -23
  8. package/src/blocks/blogs/blog-listing-3.schema.ts +713 -2010
  9. package/src/blocks/blogs/blog-listing-3.tsx +118 -20
  10. package/src/blocks/blogs/blog-post-1.schema.ts +262 -32
  11. package/src/blocks/blogs/blog-post-1.tsx +217 -28
  12. package/src/blocks/cards/cards-16.schema.ts +947 -0
  13. package/src/blocks/cards/cards-16.tsx +106 -0
  14. package/src/blocks/cards/cards-17.schema.ts +1945 -0
  15. package/src/blocks/cards/cards-17.tsx +112 -0
  16. package/src/blocks/cards/cards-18.schema.ts +1040 -0
  17. package/src/blocks/cards/cards-18.tsx +102 -0
  18. package/src/blocks/cards/cards-2.schema.ts +2 -2
  19. package/src/blocks/cards/cards-3.schema.ts +3 -16
  20. package/src/blocks/cards/cards-4.schema.ts +3 -28
  21. package/src/blocks/cards/cards-7.schema.ts +4 -7
  22. package/src/blocks/cards/cards-8.schema.ts +1 -10
  23. package/src/blocks/carousel/carousel-2.schema.ts +1 -2
  24. package/src/blocks/content/content-10.schema.ts +450 -0
  25. package/src/blocks/content/content-10.tsx +43 -0
  26. package/src/blocks/content/content-3.schema.ts +22 -28
  27. package/src/blocks/content/content-5.schema.ts +0 -4
  28. package/src/blocks/cta/cta-1.schema.ts +0 -3
  29. package/src/blocks/event/event-details.schema.ts +41 -175
  30. package/src/blocks/event/event-details.tsx +45 -50
  31. package/src/blocks/event/event-listing-2.schema.ts +437 -202
  32. package/src/blocks/event/event-listing-2.tsx +86 -22
  33. package/src/blocks/event/event-listing-3.schema.ts +232 -196
  34. package/src/blocks/event/event-listing-3.tsx +62 -29
  35. package/src/blocks/event/event-listing-4.schema.ts +314 -2824
  36. package/src/blocks/event/event-listing-4.tsx +68 -32
  37. package/src/blocks/event/event-listing.schema.ts +176 -1032
  38. package/src/blocks/event/event-listing.tsx +59 -25
  39. package/src/blocks/features/features-1/variants/stylized-cards-v2.ts +0 -1
  40. package/src/blocks/features/features-4.schema.ts +4 -14
  41. package/src/blocks/features/features-5.schema.ts +30 -51
  42. package/src/blocks/features/features-6.schema.ts +0 -1
  43. package/src/blocks/filter-listing/filter-listing-1.schema.ts +1 -3
  44. package/src/blocks/footer/footer-3.schema.ts +6 -14
  45. package/src/blocks/hero/hero-11.schema.ts +25 -54
  46. package/src/blocks/hero/hero-5.schema.ts +2 -6
  47. package/src/blocks/hero/hero-6.schema.ts +1 -10
  48. package/src/blocks/index.ts +4 -0
  49. package/src/blocks/logos/logos-1.schema.ts +0 -30
  50. package/src/blocks/pricing/pricing-1.schema.ts +0 -3
  51. package/src/blocks/stats/variants/default.ts +4 -5
  52. package/src/blocks/team/team-2.schema.ts +57 -154
  53. package/src/blocks/team/team-3.schema.ts +14 -31
  54. package/src/blocks/testimonial/testimonial-4.schema.ts +67 -152
  55. package/src/blocks/testimonial/testimonial-5/variants/default.ts +0 -1
  56. package/src/blocks/testimonial/testimonial-5/variants/testimonialWithLogo.ts +0 -1
  57. package/src/blocks/testimonial/testimonial-5/variants/testimonialWithRatings.ts +0 -1
  58. package/src/schemas/blocks.ts +8 -0
@@ -1,3 +1,4 @@
1
+ import type { IModuleStudioConfig, LevoEvent } from "@levo-so/core";
1
2
  import type { ILevoBlockBaseProps } from "@levo-so/studio";
2
3
  import {
3
4
  Box,
@@ -8,17 +9,34 @@ import {
8
9
  Image,
9
10
  Section,
10
11
  Typography,
11
- useContentEngine,
12
+ useBlockContext,
13
+ useContextEngine,
12
14
  } from "@levo-so/studio";
15
+ import dayjs from "dayjs";
13
16
 
17
+ import { ClientOnly } from "./ClientOnly";
14
18
  import type { IEventListing2Content } from "./event-listing-2.schema";
15
19
 
16
- const EventListing2: React.FC<ILevoBlockBaseProps<IEventListing2Content>> = ({}) => {
17
- const { data, query, setQuery, meta } = useContentEngine("events");
20
+ /** */
21
+ interface IEventMeta {
22
+ total: number;
23
+ pages: number;
24
+ series?: {
25
+ studio_config?: IModuleStudioConfig[];
26
+ };
27
+ }
28
+
29
+ const EventListing2: React.FC<ILevoBlockBaseProps<IEventListing2Content>> = ({ content }) => {
30
+ const { response, query, setQuery } = useContextEngine<LevoEvent.Root, IEventMeta>("events");
31
+ const { isBuilder } = useBlockContext();
18
32
 
19
33
  const handleNext = () => setQuery({ page: (query?.page || 0) + 1 });
20
34
  const handlePrevious = () => setQuery({ page: (query?.page || 0) - 1 });
21
35
 
36
+ const studioConfig = response?.meta?.series?.studio_config?.find(
37
+ (item) => !item.block_instance_id,
38
+ );
39
+
22
40
  return (
23
41
  <Section elementKey="layout">
24
42
  <Container elementKey="container">
@@ -27,39 +45,85 @@ const EventListing2: React.FC<ILevoBlockBaseProps<IEventListing2Content>> = ({})
27
45
  <Heading elementKey="title" />
28
46
  <Typography elementKey="description" />
29
47
  </Box>
30
- <Button elementKey="cta-button" />
48
+ <Box elementKey="cta-buttons_levoGroup" data-levo_group>
49
+ {content?.["cta-buttons"]?.map((item, index: number) => (
50
+ <Button key={`cta-buttons.${index}`} elementKey={`cta-buttons.${index}.cta-button`} />
51
+ ))}
52
+ </Box>
31
53
  </Box>
32
54
 
33
55
  <Box elementKey="events_levoGroup" data-levo_group>
34
- {(data ?? []).map((_: any, index: number) => (
56
+ {response?.data?.map((item, index: number) => (
35
57
  <Box
36
58
  key={`event-${index}`}
37
59
  data-levo_group_item
38
60
  elementKey={`events.${index}.eventWrapper`}
61
+ config={
62
+ (isBuilder && studioConfig?.preview_url) || (!isBuilder && studioConfig?.live_url)
63
+ ? {
64
+ action: {
65
+ type: "external_link",
66
+ value:
67
+ isBuilder && studioConfig.preview_url
68
+ ? studioConfig.preview_url.replace(/\{[^}]+\}/g, item?.slug)
69
+ : !isBuilder && studioConfig.live_url
70
+ ? studioConfig.live_url.replace(/\{[^}]+\}/g, item?.slug)
71
+ : "",
72
+ options: {},
73
+ },
74
+ }
75
+ : {}
76
+ }
39
77
  >
40
- <Image elementKey={`events.${index}.image`} alt="Event image" />
78
+ <Image
79
+ elementKey={`events.${index}.image`}
80
+ alt="Event image"
81
+ image={item?.cover_image ?? undefined}
82
+ />
41
83
 
42
84
  <Box elementKey={`events.${index}.content-wrapper`}>
43
- <Heading elementKey={`events.${index}.title`} />
44
- <Typography elementKey={`events.${index}.description`} />
85
+ <Heading elementKey={`events.${index}.title`}>{item?.title}</Heading>
86
+ <Typography elementKey={`events.${index}.description`}>
87
+ {item?.description}
88
+ </Typography>
45
89
 
46
- <Box elementKey={`events.${index}.details_levoGroup`} data-levo_group>
47
- {(data?.[index]?.details ?? []).map((_: any, detailIndex: number) => (
48
- <Box
49
- key={`detail-${detailIndex}`}
50
- data-levo_group_item
51
- elementKey={`events.${index}.details.${detailIndex}.detailWrapper`}
52
- >
53
- <Icon elementKey={`events.${index}.details.${detailIndex}.icon`} />
54
- <Typography elementKey={`events.${index}.details.${detailIndex}.text`} />
55
- </Box>
56
- ))}
90
+ <Box elementKey={`events.${index}.details_container`}>
91
+ <Box elementKey={`events.${index}.date_detail_wrapper`}>
92
+ <Icon elementKey={`events.${index}.date_icon`} />
93
+ <ClientOnly>
94
+ <Typography elementKey={`events.${index}.date_text`}>
95
+ {dayjs(item?.starts_at).format("MMM D, YYYY")}
96
+ </Typography>
97
+ </ClientOnly>
98
+ </Box>
99
+ <Box elementKey={`events.${index}.time_detail_wrapper`}>
100
+ <Icon elementKey={`events.${index}.time_icon`} />
101
+ <ClientOnly>
102
+ <Typography elementKey={`events.${index}.time_text`}>
103
+ {item?.starts_at && item?.ends_at
104
+ ? `${dayjs(item.starts_at).format("h:mm A")} - ${dayjs(item.ends_at).format("h:mm A")}`
105
+ : "Time TBA"}
106
+ </Typography>
107
+ </ClientOnly>
108
+ </Box>
109
+ <Box elementKey={`events.${index}.location_detail_wrapper`}>
110
+ <Icon elementKey={`events.${index}.location_icon`} />
111
+ <Typography elementKey={`events.${index}.location_text`}>
112
+ {item?.location?.place_name || "Location TBA"}
113
+ </Typography>
114
+ </Box>
115
+ <Box elementKey={`events.${index}.type_detail_wrapper`}>
116
+ <Icon elementKey={`events.${index}.type_icon`} />
117
+ <Typography elementKey={`events.${index}.type_text`}>
118
+ {item?.kind === "virtual" ? "Virtual Event" : "In-Person Event"}
119
+ </Typography>
120
+ </Box>
57
121
  </Box>
58
122
  </Box>
59
123
  </Box>
60
124
  ))}
61
125
  </Box>
62
- {(meta?.pages || 0) > 1 && (
126
+ {response?.meta && (
63
127
  <Box elementKey="paginationWrapper">
64
128
  <Button
65
129
  elementKey="paginationLeftButton"
@@ -68,12 +132,12 @@ const EventListing2: React.FC<ILevoBlockBaseProps<IEventListing2Content>> = ({})
68
132
  />
69
133
 
70
134
  <Typography elementKey="paginationText">
71
- {`${query?.page || 0}/${meta?.pages || 0}`}
135
+ {`${query?.page || 0}/${response?.meta?.pages || 0}`}
72
136
  </Typography>
73
137
  <Button
74
138
  elementKey="paginationRightButton"
75
139
  onClick={handleNext}
76
- disabled={query?.page === meta?.pages}
140
+ disabled={query?.page === response?.meta?.pages}
77
141
  />
78
142
  </Box>
79
143
  )}