@windstream/react-shared-components 0.1.95 → 0.1.96

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.
@@ -1,248 +1,248 @@
1
- import React, { useState } from "react";
2
- import { Button } from "../button";
3
- import { PlayButton } from "./helper";
4
- import { ImagePromoBarProps } from "./types";
5
- import { VimeoEmbed } from "./vimeo-embed";
6
- import { YoutubeEmbed } from "./youtube-embed";
7
-
8
- import { Checklist } from "@shared/components/checklist";
9
- import { Image } from "@shared/components/image";
10
- import { Link } from "@shared/components/link";
11
- import { NextImage } from "@shared/components/next-image";
12
- import { Text } from "@shared/components/text";
13
- import { cx } from "@shared/utils";
14
-
15
- export const ImagePromoBar: React.FC<ImagePromoBarProps> = ({
16
- brow,
17
- enableHeading,
18
- title,
19
- subTitle,
20
- ctaDisclaimer,
21
- disclaimer,
22
- description,
23
- image,
24
- imageLinks,
25
- mediaPosition = true,
26
- checklist,
27
- secondaryCta,
28
- cta,
29
- videoLink,
30
- maxWidth = true,
31
- color = "light",
32
- imageWidth = 660,
33
- imageHeight = 660,
34
- onModalButtonClick,
35
- renderCheckPlans,
36
- }) => {
37
- const [activeVideo, setActiveVideo] = useState("");
38
- const [isHovered, setIsHovered] = useState(false);
39
-
40
- const handlePlayClick = () => {
41
- setActiveVideo(videoLink?.link ?? "");
42
- };
43
-
44
- const handleCloseVideo = (e: React.MouseEvent) => {
45
- e.stopPropagation();
46
- setActiveVideo("");
47
- };
48
-
49
- const videoHref = videoLink?.link ?? "";
50
- const videoImage = videoLink?.image;
51
- const videoPopup = videoLink?.videoPopup ?? false;
52
- const isPlaying = Boolean(activeVideo && activeVideo === videoHref);
53
-
54
- const embedSelector = () => {
55
- if (videoHref.includes("vimeo")) {
56
- return <VimeoEmbed link={videoHref} autoplay={isPlaying} />;
57
- } else {
58
- return <YoutubeEmbed link={videoHref} autoplay={isPlaying} />;
59
- }
60
- };
61
- const contentVideo = videoLink && videoImage ? embedSelector() : null;
62
-
63
- return (
64
- <div className="component-container shared-component-ipb">
65
- <div
66
- className={`image-promo-bar-content ${maxWidth ? "max-w-120 xl:mx-auto" : ""} mx-5 mb-8 mt-16 md:mx-10`}
67
- >
68
- <div
69
- className={`flex shrink-0 flex-col items-center gap-8 xl:items-stretch xl:gap-10 xl:gap-[126px] ${mediaPosition ? "xl:flex-row-reverse" : "xl:flex-row"}`}
70
- >
71
- <div
72
- className={`flex flex-[1_0_0] flex-col items-start justify-center gap-8 xl:gap-10 ${color == "dark" ? "text-text" : "text-white"}`}
73
- >
74
- <div className="heading holder">
75
- {brow && (
76
- <Text
77
- as="div"
78
- className="subheading4 mb-4 text-text-brand xl:subheading2 xl:mb-3"
79
- >
80
- {brow}
81
- </Text>
82
- )}
83
- {title && (
84
- <Text
85
- as={enableHeading ? "h1" : "h2"}
86
- className="heading2 xl:heading1"
87
- >
88
- {title}
89
- </Text>
90
- )}
91
- {subTitle && (
92
- <Text
93
- as={enableHeading ? "h2" : "h3"}
94
- className="subheading3 mt-3 md:subheading1"
95
- >
96
- {subTitle}
97
- </Text>
98
- )}
99
- </div>
100
- {/* Content Section */}
101
- {description && (
102
- <Text as="div" className="body1">
103
- {description}
104
- </Text>
105
- )}
106
- {/* Checklist Rendering */}
107
- {checklist.length > 0 && (
108
- <Checklist
109
- items={checklist}
110
- iconPosition="top"
111
- iconSize={24}
112
- listItemClassName="body1 text-text"
113
- listContainerClassName="mt-0 space-y-0 flex flex-col gap-3"
114
- />
115
- )}
116
- {imageLinks.length > 0 && (
117
- <div className="flex gap-4">
118
- {/* Image Links Collection */}
119
- {imageLinks?.map(
120
- (link: { url: string; image: string }, index: number) => (
121
- <div key={index} className="image-link w-[147px]">
122
- <Link
123
- variant="unstyled"
124
- href={link.url}
125
- target="_blank"
126
- rel="noopener noreferrer"
127
- >
128
- <Image src={link.image} alt="icon-link" />
129
- </Link>
130
- </div>
131
- )
132
- )}
133
- </div>
134
- )}
135
- {/* CTAs and Disclaimers */}
136
- {(cta || secondaryCta) && (
137
- <div className="flex w-full flex-col gap-3 xl:flex-row">
138
- {cta && (
139
- <div className="primary-cta w-full xl:w-auto xl:shrink-0">
140
- <Button
141
- {...cta}
142
- fullWidth={true}
143
- size={{ base: "large" }}
144
- renderCheckPlans={renderCheckPlans}
145
- onModalButtonClick={onModalButtonClick}
146
- />
147
- </div>
148
- )}
149
- {secondaryCta && (
150
- <div className="secondary-cta w-full xl:w-auto xl:shrink-0">
151
- <Button
152
- {...secondaryCta}
153
- fullWidth={true}
154
- size={{ base: "large" }}
155
- renderCheckPlans={renderCheckPlans}
156
- onModalButtonClick={onModalButtonClick}
157
- />
158
- </div>
159
- )}
160
- </div>
161
- )}
162
- {ctaDisclaimer && <div>{ctaDisclaimer}</div>}
163
- </div>
164
- <aside className="flex w-full shrink-0 items-center justify-center lg:w-auto">
165
- {/* Media Section */}
166
- {image && (
167
- <div className="relative h-[334px] w-[334px] overflow-hidden rounded-image md:h-[486px] md:w-[486px]">
168
- <NextImage
169
- src={image}
170
- alt="section-image"
171
- fill={true}
172
- sizes="(min-width: 768px) 486px, 334px"
173
- className="object-cover"
174
- />
175
- </div>
176
- )}
177
- {/* Video Link Section */}
178
- {videoLink?.link && (
179
- <div
180
- className={cx(
181
- "video-section relative w-full cursor-pointer overflow-hidden rounded-image transition-all duration-300 lg:w-[486px]",
182
- !isPlaying && "hover:shadow-2xl"
183
- )}
184
- onClick={handlePlayClick}
185
- onMouseEnter={() => setIsHovered(true)}
186
- onMouseLeave={() => setIsHovered(false)}
187
- >
188
- {/* Preview Image & Play Button */}
189
- <div
190
- className={cx(
191
- isPlaying && !videoPopup && "hidden",
192
- isPlaying && !videoPopup ? "opacity-0" : "opacity-100",
193
- "relative aspect-[16/9] w-full transition-opacity duration-300 xl:aspect-square"
194
- )}
195
- >
196
- {videoLink.image && (
197
- <NextImage
198
- src={videoLink.image}
199
- alt="Video preview"
200
- width={486}
201
- height={486}
202
- className="absolute inset-0 h-full w-full rounded-image object-cover"
203
- />
204
- )}
205
- <div className="absolute inset-0 flex items-center justify-center">
206
- <PlayButton isHovered={isHovered} />
207
- </div>
208
- </div>
209
-
210
- {/* Inline Player (if not popup) */}
211
- {!videoPopup && isPlaying && (
212
- <div
213
- className={cx(
214
- "aspect-[16/9] w-full overflow-hidden rounded-image transition-opacity duration-300",
215
- isPlaying ? "opacity-100" : "opacity-0"
216
- )}
217
- >
218
- {contentVideo}
219
- </div>
220
- )}
221
- </div>
222
- )}
223
- </aside>
224
- </div>
225
- </div>
226
-
227
- {/* Video Popup Overlay */}
228
- {videoPopup && isPlaying && (
229
- <div
230
- className="fixed inset-0 top-20 z-[100] flex items-center justify-center bg-black/80 p-4 transition-all duration-300"
231
- onClick={handleCloseVideo}
232
- >
233
- <div
234
- className="max-w-6xl aspect-video w-full overflow-hidden rounded-3xl bg-black shadow-2xl md:w-4/6"
235
- onClick={e => e.stopPropagation()}
236
- >
237
- {contentVideo}
238
- </div>
239
- </div>
240
- )}
241
- {disclaimer && (
242
- <div className="mt-10 flex justify-center xl:mt-18">{disclaimer}</div>
243
- )}
244
- </div>
245
- );
246
- };
247
-
248
- export default ImagePromoBar;
1
+ import React, { useState } from "react";
2
+ import { Button } from "../button";
3
+ import { PlayButton } from "./helper";
4
+ import { ImagePromoBarProps } from "./types";
5
+ import { VimeoEmbed } from "./vimeo-embed";
6
+ import { YoutubeEmbed } from "./youtube-embed";
7
+
8
+ import { Checklist } from "@shared/components/checklist";
9
+ import { Image } from "@shared/components/image";
10
+ import { Link } from "@shared/components/link";
11
+ import { NextImage } from "@shared/components/next-image";
12
+ import { Text } from "@shared/components/text";
13
+ import { cx } from "@shared/utils";
14
+
15
+ export const ImagePromoBar: React.FC<ImagePromoBarProps> = ({
16
+ brow,
17
+ enableHeading,
18
+ title,
19
+ subTitle,
20
+ ctaDisclaimer,
21
+ disclaimer,
22
+ description,
23
+ image,
24
+ imageLinks,
25
+ mediaPosition = true,
26
+ checklist,
27
+ secondaryCta,
28
+ cta,
29
+ videoLink,
30
+ maxWidth = true,
31
+ color = "light",
32
+ imageWidth = 660,
33
+ imageHeight = 660,
34
+ onModalButtonClick,
35
+ renderCheckPlans,
36
+ }) => {
37
+ const [activeVideo, setActiveVideo] = useState("");
38
+ const [isHovered, setIsHovered] = useState(false);
39
+
40
+ const handlePlayClick = () => {
41
+ setActiveVideo(videoLink?.link ?? "");
42
+ };
43
+
44
+ const handleCloseVideo = (e: React.MouseEvent) => {
45
+ e.stopPropagation();
46
+ setActiveVideo("");
47
+ };
48
+
49
+ const videoHref = videoLink?.link ?? "";
50
+ const videoImage = videoLink?.image;
51
+ const videoPopup = videoLink?.videoPopup ?? false;
52
+ const isPlaying = Boolean(activeVideo && activeVideo === videoHref);
53
+
54
+ const embedSelector = () => {
55
+ if (videoHref.includes("vimeo")) {
56
+ return <VimeoEmbed link={videoHref} autoplay={isPlaying} />;
57
+ } else {
58
+ return <YoutubeEmbed link={videoHref} autoplay={isPlaying} />;
59
+ }
60
+ };
61
+ const contentVideo = videoLink && videoImage ? embedSelector() : null;
62
+
63
+ return (
64
+ <div className="component-container shared-component-ipb">
65
+ <div
66
+ className={`image-promo-bar-content ${maxWidth ? "max-w-120 xl:mx-auto" : ""} mx-5 mb-8 mt-16 md:mx-10`}
67
+ >
68
+ <div
69
+ className={`flex shrink-0 flex-col items-center gap-8 xl:items-stretch xl:gap-10 xl:gap-[126px] ${mediaPosition ? "xl:flex-row-reverse" : "xl:flex-row"}`}
70
+ >
71
+ <div
72
+ className={`flex flex-[1_0_0] flex-col items-start justify-center gap-8 xl:gap-10 ${color == "dark" ? "text-text" : "text-white"}`}
73
+ >
74
+ <div className="heading holder">
75
+ {brow && (
76
+ <Text
77
+ as="div"
78
+ className="subheading4 mb-4 text-text-brand xl:subheading2 xl:mb-3"
79
+ >
80
+ {brow}
81
+ </Text>
82
+ )}
83
+ {title && (
84
+ <Text
85
+ as={enableHeading ? "h1" : "h2"}
86
+ className="heading2 xl:heading1"
87
+ >
88
+ {title}
89
+ </Text>
90
+ )}
91
+ {subTitle && (
92
+ <Text
93
+ as={enableHeading ? "h2" : "h3"}
94
+ className="subheading3 mt-3 md:subheading1"
95
+ >
96
+ {subTitle}
97
+ </Text>
98
+ )}
99
+ </div>
100
+ {/* Content Section */}
101
+ {description && (
102
+ <Text as="div" className="body1">
103
+ {description}
104
+ </Text>
105
+ )}
106
+ {/* Checklist Rendering */}
107
+ {checklist.length > 0 && (
108
+ <Checklist
109
+ items={checklist}
110
+ iconPosition="top"
111
+ iconSize={24}
112
+ listItemClassName="body1 text-text"
113
+ listContainerClassName="mt-0 space-y-0 flex flex-col gap-3"
114
+ />
115
+ )}
116
+ {imageLinks.length > 0 && (
117
+ <div className="flex gap-4">
118
+ {/* Image Links Collection */}
119
+ {imageLinks?.map(
120
+ (link: { url: string; image: string }, index: number) => (
121
+ <div key={index} className="image-link w-[147px]">
122
+ <Link
123
+ variant="unstyled"
124
+ href={link.url}
125
+ target="_blank"
126
+ rel="noopener noreferrer"
127
+ >
128
+ <Image src={link.image} alt="icon-link" />
129
+ </Link>
130
+ </div>
131
+ )
132
+ )}
133
+ </div>
134
+ )}
135
+ {/* CTAs and Disclaimers */}
136
+ {(cta || secondaryCta) && (
137
+ <div className="flex w-full flex-col gap-3 xl:flex-row">
138
+ {cta && (
139
+ <div className="primary-cta w-full xl:w-auto xl:shrink-0">
140
+ <Button
141
+ {...cta}
142
+ fullWidth={true}
143
+ size={{ base: "large" }}
144
+ renderCheckPlans={renderCheckPlans}
145
+ onModalButtonClick={onModalButtonClick}
146
+ />
147
+ </div>
148
+ )}
149
+ {secondaryCta && (
150
+ <div className="secondary-cta w-full xl:w-auto xl:shrink-0">
151
+ <Button
152
+ {...secondaryCta}
153
+ fullWidth={true}
154
+ size={{ base: "large" }}
155
+ renderCheckPlans={renderCheckPlans}
156
+ onModalButtonClick={onModalButtonClick}
157
+ />
158
+ </div>
159
+ )}
160
+ </div>
161
+ )}
162
+ {ctaDisclaimer && <div>{ctaDisclaimer}</div>}
163
+ </div>
164
+ <aside className="flex w-full shrink-0 items-center justify-center lg:w-auto">
165
+ {/* Media Section */}
166
+ {image && (
167
+ <div className="relative h-[334px] w-[334px] overflow-hidden rounded-image md:h-[486px] md:w-[486px]">
168
+ <NextImage
169
+ src={image}
170
+ alt="section-image"
171
+ fill={true}
172
+ sizes="(min-width: 768px) 486px, 334px"
173
+ className="object-cover"
174
+ />
175
+ </div>
176
+ )}
177
+ {/* Video Link Section */}
178
+ {videoLink?.link && (
179
+ <div
180
+ className={cx(
181
+ "video-section relative w-full cursor-pointer overflow-hidden rounded-image transition-all duration-300 lg:w-[486px]",
182
+ !isPlaying && "hover:shadow-2xl"
183
+ )}
184
+ onClick={handlePlayClick}
185
+ onMouseEnter={() => setIsHovered(true)}
186
+ onMouseLeave={() => setIsHovered(false)}
187
+ >
188
+ {/* Preview Image & Play Button */}
189
+ <div
190
+ className={cx(
191
+ isPlaying && !videoPopup && "hidden",
192
+ isPlaying && !videoPopup ? "opacity-0" : "opacity-100",
193
+ "relative aspect-[16/9] w-full transition-opacity duration-300 xl:aspect-square"
194
+ )}
195
+ >
196
+ {videoLink.image && (
197
+ <NextImage
198
+ src={videoLink.image}
199
+ alt="Video preview"
200
+ width={486}
201
+ height={486}
202
+ className="absolute inset-0 h-full w-full rounded-image object-cover"
203
+ />
204
+ )}
205
+ <div className="absolute inset-0 flex items-center justify-center">
206
+ <PlayButton isHovered={isHovered} />
207
+ </div>
208
+ </div>
209
+
210
+ {/* Inline Player (if not popup) */}
211
+ {!videoPopup && isPlaying && (
212
+ <div
213
+ className={cx(
214
+ "aspect-[16/9] w-full overflow-hidden rounded-image transition-opacity duration-300",
215
+ isPlaying ? "opacity-100" : "opacity-0"
216
+ )}
217
+ >
218
+ {contentVideo}
219
+ </div>
220
+ )}
221
+ </div>
222
+ )}
223
+ </aside>
224
+ </div>
225
+ </div>
226
+
227
+ {/* Video Popup Overlay */}
228
+ {videoPopup && isPlaying && (
229
+ <div
230
+ className="fixed inset-0 top-20 z-[100] flex items-center justify-center bg-black/80 p-4 transition-all duration-300"
231
+ onClick={handleCloseVideo}
232
+ >
233
+ <div
234
+ className="max-w-6xl aspect-video w-full overflow-hidden rounded-3xl bg-black shadow-2xl md:w-4/6"
235
+ onClick={e => e.stopPropagation()}
236
+ >
237
+ {contentVideo}
238
+ </div>
239
+ </div>
240
+ )}
241
+ {disclaimer && (
242
+ <div className="mt-10 flex justify-center xl:mt-18">{disclaimer}</div>
243
+ )}
244
+ </div>
245
+ );
246
+ };
247
+
248
+ export default ImagePromoBar;
@@ -10,7 +10,12 @@ export interface Asset {
10
10
  }
11
11
  export interface Button {
12
12
  anchorId?: string | null;
13
- showButtonAs?: "solid" | "text" | null;
13
+ showButtonAs?:
14
+ | "solid"
15
+ | "text"
16
+ | "button-with-icon"
17
+ | "text-with-icon"
18
+ | null;
14
19
  buttonLabel: string; // required in your model
15
20
  buttonPrefix?: string | null;
16
21
  href?: string | null;
@@ -87,7 +92,13 @@ export type CheckPlansProps = {
87
92
  ctaAlignment?: "new-row" | "same-row";
88
93
  ctaText?: string;
89
94
  buttonVariant?: "primary_brand" | "secondary" | "primary_inverse";
90
- showButtonAs?: "solid" | "unstyled" | "text" | undefined;
95
+ showButtonAs?:
96
+ | "solid"
97
+ | "unstyled"
98
+ | "text"
99
+ | "button-with-icon"
100
+ | "text-with-icon"
101
+ | undefined;
91
102
  cta?: ButtonProps;
92
103
  speedCardConfig?: {
93
104
  isModalOpen?: boolean;