@windstream/react-shared-components 0.1.71 → 0.1.73
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/dist/contentful/index.d.ts +104 -28
- package/dist/contentful/index.esm.js +2 -2
- package/dist/contentful/index.esm.js.map +1 -1
- package/dist/contentful/index.js +2 -2
- package/dist/contentful/index.js.map +1 -1
- package/dist/core.d.ts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/next/index.esm.js.map +1 -1
- package/dist/next/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/utils/index.d.ts +12 -1
- package/dist/utils/index.esm.js +1 -1
- package/dist/utils/index.esm.js.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/next-image/index.tsx +3 -1
- package/src/contentful/blocks/accordion/Accordion.stories.mocks.tsx +8 -8
- package/src/contentful/blocks/accordion/Accordion.stories.tsx +5 -13
- package/src/contentful/blocks/anchored-bottom-banner/index.tsx +114 -3
- package/src/contentful/blocks/anchored-bottom-banner/types.ts +4 -1
- package/src/contentful/blocks/callout/index.tsx +201 -37
- package/src/contentful/blocks/callout/types.ts +56 -3
- package/src/contentful/blocks/cards/floating-image-card/index.tsx +119 -0
- package/src/contentful/blocks/cards/floating-image-card/types.ts +30 -0
- package/src/contentful/blocks/cards/full-image-card/index.tsx +130 -0
- package/src/contentful/blocks/cards/full-image-card/types.ts +29 -0
- package/src/contentful/blocks/cards/simple-card/index.tsx +294 -58
- package/src/contentful/blocks/cards/simple-card/types.ts +47 -4
- package/src/contentful/blocks/comparison-table/index.tsx +3 -1
- package/src/contentful/blocks/footer/Footer.stories.tsx +145 -32
- package/src/hooks/contentful/use-contentful-rich-text.tsx +5 -3
- package/src/utils/index.ts +3 -0
- package/src/utils/speed-card-bg.ts +24 -0
|
@@ -1,15 +1,68 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ButtonProps } from "../button/types";
|
|
3
|
+
|
|
4
|
+
export type CalloutCardType = "simple" | "blog" | "fullImage" | "floatingImage";
|
|
5
|
+
|
|
6
|
+
export type CalloutCtaProps = ButtonProps & {
|
|
7
|
+
label?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type CalloutItem = {
|
|
11
|
+
/**
|
|
12
|
+
* Optional per-item card type. When provided, overrides the top-level
|
|
13
|
+
* `cardType` for this single item — enables mixed card variants in one
|
|
14
|
+
* Callout (e.g. one full-image + two simple cards).
|
|
15
|
+
*/
|
|
16
|
+
cardType?: CalloutCardType;
|
|
17
|
+
// Permissive shape — concrete card components validate their own subset.
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
};
|
|
20
|
+
|
|
1
21
|
export type CalloutProps = {
|
|
22
|
+
/** Outer `<section>` id — anchor link target. */
|
|
23
|
+
anchorId?: string;
|
|
2
24
|
title?: string;
|
|
3
25
|
enableHeading?: boolean;
|
|
4
26
|
subtitle?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
finePrint?: ReactNode;
|
|
29
|
+
cta?: CalloutCtaProps;
|
|
5
30
|
applyBoxShadow?: boolean;
|
|
6
31
|
cardStackingMobile?: boolean;
|
|
7
32
|
bottomText?: string;
|
|
8
33
|
color?: "dark" | "light";
|
|
9
|
-
|
|
34
|
+
/**
|
|
35
|
+
* When `true` (default) cards are laid out in a responsive Tailwind
|
|
36
|
+
* grid sized by `maxCardsPerRow`. When `false` the cards stretch
|
|
37
|
+
* full-width and stack vertically (no inner widths).
|
|
38
|
+
*/
|
|
39
|
+
cardsWidth?: boolean;
|
|
10
40
|
maxCardsPerRow?: number;
|
|
11
41
|
noGutter?: boolean;
|
|
12
|
-
items:
|
|
42
|
+
items: CalloutItem[];
|
|
13
43
|
maxWidth?: boolean;
|
|
14
|
-
|
|
44
|
+
/** Top-level card type used when an item does not specify its own. */
|
|
45
|
+
cardType?: CalloutCardType;
|
|
46
|
+
/**
|
|
47
|
+
* Background color token. When omitted the section has no background
|
|
48
|
+
* (preserves prior behavior for existing 0.1.70 consumers).
|
|
49
|
+
*/
|
|
50
|
+
backgroundColor?:
|
|
51
|
+
| "cream500"
|
|
52
|
+
| "gray100"
|
|
53
|
+
| "white"
|
|
54
|
+
| "transparent"
|
|
55
|
+
| "blue"
|
|
56
|
+
| "green"
|
|
57
|
+
| "navy"
|
|
58
|
+
| "purple"
|
|
59
|
+
| "yellow";
|
|
60
|
+
/** Raw background CSS value (overrides `backgroundColor` when present). */
|
|
61
|
+
background?: string;
|
|
62
|
+
/** Inline text color override applied to the heading region. */
|
|
63
|
+
textColor?: string;
|
|
64
|
+
/** Extra class names for the outer <section>. */
|
|
65
|
+
containerClassName?: string;
|
|
66
|
+
/** Extra class names for the inner content wrapper. */
|
|
67
|
+
innerClassName?: string;
|
|
15
68
|
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button } from "../../button";
|
|
3
|
+
import { FloatingImageCardProps } from "./types";
|
|
4
|
+
|
|
5
|
+
import { NextImage } from "@shared/components/next-image";
|
|
6
|
+
import { Text } from "@shared/components/text";
|
|
7
|
+
import { cx } from "@shared/utils";
|
|
8
|
+
|
|
9
|
+
const alignmentClasses: Record<string, string> = {
|
|
10
|
+
left: "flex w-full justify-start",
|
|
11
|
+
right: "flex w-full justify-end",
|
|
12
|
+
center: "flex w-full justify-center",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const FloatingImageCard: React.FC<FloatingImageCardProps> = ({
|
|
16
|
+
card,
|
|
17
|
+
lgWidth,
|
|
18
|
+
mdWidth,
|
|
19
|
+
}) => {
|
|
20
|
+
const {
|
|
21
|
+
image,
|
|
22
|
+
title,
|
|
23
|
+
header,
|
|
24
|
+
body,
|
|
25
|
+
cta,
|
|
26
|
+
ctaAlignment,
|
|
27
|
+
imageLink,
|
|
28
|
+
imageClassName,
|
|
29
|
+
className,
|
|
30
|
+
isPromoBarImg = false,
|
|
31
|
+
shadow = false,
|
|
32
|
+
} = card;
|
|
33
|
+
|
|
34
|
+
const ctaAlignmentClass = ctaAlignment
|
|
35
|
+
? alignmentClasses[ctaAlignment]
|
|
36
|
+
: alignmentClasses.left;
|
|
37
|
+
const imageLinkAvailableClass = imageLink ? "cursor-pointer" : "";
|
|
38
|
+
|
|
39
|
+
const handleImageClick = imageLink
|
|
40
|
+
? () => {
|
|
41
|
+
if (typeof window !== "undefined") {
|
|
42
|
+
window.open(imageLink, "_blank");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
: undefined;
|
|
46
|
+
|
|
47
|
+
if (isPromoBarImg) {
|
|
48
|
+
return image?.href ? (
|
|
49
|
+
<NextImage
|
|
50
|
+
src={image.href}
|
|
51
|
+
alt={image.title ?? title ?? "promo-bar-image"}
|
|
52
|
+
width={148}
|
|
53
|
+
height={40}
|
|
54
|
+
onClick={handleImageClick}
|
|
55
|
+
className={imageLinkAvailableClass}
|
|
56
|
+
/>
|
|
57
|
+
) : null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<section
|
|
62
|
+
aria-labelledby="Image Card"
|
|
63
|
+
className={cx(
|
|
64
|
+
"callout-card relative flex h-full w-full flex-col gap-4 p-0 md:items-start lg:gap-6",
|
|
65
|
+
shadow && "rounded-3xl shadow-card",
|
|
66
|
+
mdWidth,
|
|
67
|
+
lgWidth,
|
|
68
|
+
className
|
|
69
|
+
)}
|
|
70
|
+
>
|
|
71
|
+
{image?.href ? (
|
|
72
|
+
<div
|
|
73
|
+
className={cx(
|
|
74
|
+
"relative aspect-video w-full overflow-hidden rounded-[40px] sm:mb-1 md:flex-none lg:mb-0",
|
|
75
|
+
imageClassName
|
|
76
|
+
)}
|
|
77
|
+
>
|
|
78
|
+
<NextImage
|
|
79
|
+
src={image.href}
|
|
80
|
+
alt={image.title ?? title ?? "card-image"}
|
|
81
|
+
width={image.width || 400}
|
|
82
|
+
height={image.height || 285}
|
|
83
|
+
onClick={handleImageClick}
|
|
84
|
+
className={cx(
|
|
85
|
+
"h-full max-h-[285px] w-full object-cover",
|
|
86
|
+
imageLinkAvailableClass
|
|
87
|
+
)}
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
) : null}
|
|
91
|
+
|
|
92
|
+
{header ? (
|
|
93
|
+
<Text as="h6" className="heading6 font-black text-text lg:pb-2">
|
|
94
|
+
{header}
|
|
95
|
+
</Text>
|
|
96
|
+
) : null}
|
|
97
|
+
|
|
98
|
+
{body ? (
|
|
99
|
+
<Text as="div" className="body2 mb-0 flex-1 text-text">
|
|
100
|
+
{body}
|
|
101
|
+
</Text>
|
|
102
|
+
) : null}
|
|
103
|
+
|
|
104
|
+
<div className={cx(ctaAlignmentClass, "mt-auto")}>
|
|
105
|
+
{cta ? (
|
|
106
|
+
<Button
|
|
107
|
+
linkVariant="unstyled"
|
|
108
|
+
linkClassName="label1 flex items-center gap-2 text-text"
|
|
109
|
+
{...cta}
|
|
110
|
+
iconName="expand_circle_right"
|
|
111
|
+
iconFill={1}
|
|
112
|
+
/>
|
|
113
|
+
) : null}
|
|
114
|
+
</div>
|
|
115
|
+
</section>
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export default FloatingImageCard;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ButtonProps } from "../../button/types";
|
|
3
|
+
|
|
4
|
+
export type FloatingImageAsset = {
|
|
5
|
+
href: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type FloatingImageCardItem = {
|
|
12
|
+
title?: string;
|
|
13
|
+
header?: string;
|
|
14
|
+
body?: ReactNode;
|
|
15
|
+
cta?: ButtonProps;
|
|
16
|
+
ctaAlignment?: "left" | "right" | "center";
|
|
17
|
+
image?: FloatingImageAsset;
|
|
18
|
+
imageLink?: string;
|
|
19
|
+
imageClassName?: string;
|
|
20
|
+
className?: string;
|
|
21
|
+
isPromoBarImg?: boolean;
|
|
22
|
+
/** Applies `shadow-card` to the outer card element. */
|
|
23
|
+
shadow?: boolean;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type FloatingImageCardProps = {
|
|
27
|
+
card: FloatingImageCardItem;
|
|
28
|
+
lgWidth?: string;
|
|
29
|
+
mdWidth?: string;
|
|
30
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button } from "../../button";
|
|
3
|
+
import { FullImageCardProps } from "./types";
|
|
4
|
+
|
|
5
|
+
import { Link } from "@shared/components/link";
|
|
6
|
+
import { NextImage } from "@shared/components/next-image";
|
|
7
|
+
import { Text } from "@shared/components/text";
|
|
8
|
+
import { cx } from "@shared/utils";
|
|
9
|
+
|
|
10
|
+
export const FullImageCard: React.FC<FullImageCardProps> = ({
|
|
11
|
+
card,
|
|
12
|
+
lgWidth,
|
|
13
|
+
mdWidth,
|
|
14
|
+
}) => {
|
|
15
|
+
const {
|
|
16
|
+
anchorId = "FullImageCard",
|
|
17
|
+
title,
|
|
18
|
+
description,
|
|
19
|
+
caption,
|
|
20
|
+
image,
|
|
21
|
+
cta,
|
|
22
|
+
link,
|
|
23
|
+
className,
|
|
24
|
+
contentClassName,
|
|
25
|
+
imageClassName,
|
|
26
|
+
shadow = true,
|
|
27
|
+
} = card;
|
|
28
|
+
|
|
29
|
+
const target = cta || link;
|
|
30
|
+
const href = target?.href;
|
|
31
|
+
|
|
32
|
+
const renderImage = () => {
|
|
33
|
+
if (!image?.href) return null;
|
|
34
|
+
|
|
35
|
+
const img = (
|
|
36
|
+
<NextImage
|
|
37
|
+
src={image.href}
|
|
38
|
+
alt={image.title ?? title ?? "card-image"}
|
|
39
|
+
width={image.width || 400}
|
|
40
|
+
height={image.height || 280}
|
|
41
|
+
className="w-full"
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return href ? (
|
|
46
|
+
<Link href={href} tabIndex={-1} target={target?.target}>
|
|
47
|
+
{img}
|
|
48
|
+
</Link>
|
|
49
|
+
) : (
|
|
50
|
+
img
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const titleNode = title ? (
|
|
55
|
+
<Text as="h3" className="body1 text-text xl:heading6">
|
|
56
|
+
{title}
|
|
57
|
+
</Text>
|
|
58
|
+
) : null;
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<section
|
|
62
|
+
id={anchorId}
|
|
63
|
+
className={cx(
|
|
64
|
+
"callout-card relative flex flex-col rounded-3xl bg-white p-0",
|
|
65
|
+
shadow && "shadow-card",
|
|
66
|
+
mdWidth,
|
|
67
|
+
lgWidth,
|
|
68
|
+
"w-full",
|
|
69
|
+
className
|
|
70
|
+
)}
|
|
71
|
+
aria-labelledby={`card-title-${anchorId}`}
|
|
72
|
+
>
|
|
73
|
+
{image?.href ? (
|
|
74
|
+
<div
|
|
75
|
+
className={cx(
|
|
76
|
+
"relative aspect-video overflow-hidden rounded-tl-3xl rounded-tr-3xl",
|
|
77
|
+
imageClassName
|
|
78
|
+
)}
|
|
79
|
+
>
|
|
80
|
+
{renderImage()}
|
|
81
|
+
</div>
|
|
82
|
+
) : null}
|
|
83
|
+
<div
|
|
84
|
+
className={cx(
|
|
85
|
+
"flex h-full flex-col gap-4 p-6 md:p-8",
|
|
86
|
+
contentClassName
|
|
87
|
+
)}
|
|
88
|
+
>
|
|
89
|
+
<div className="flex flex-1 flex-col justify-between">
|
|
90
|
+
<div>
|
|
91
|
+
{href && titleNode ? (
|
|
92
|
+
<Link
|
|
93
|
+
href={href}
|
|
94
|
+
target={target?.target}
|
|
95
|
+
className="no-underline hover:underline"
|
|
96
|
+
>
|
|
97
|
+
{titleNode}
|
|
98
|
+
</Link>
|
|
99
|
+
) : (
|
|
100
|
+
titleNode
|
|
101
|
+
)}
|
|
102
|
+
{description ? (
|
|
103
|
+
<Text as="p" className="body2 mt-4 text-text md:body1">
|
|
104
|
+
{description}
|
|
105
|
+
</Text>
|
|
106
|
+
) : null}
|
|
107
|
+
</div>
|
|
108
|
+
{caption ? (
|
|
109
|
+
<Text as="p" className="footnote mt-5 text-text-secondary">
|
|
110
|
+
{caption}
|
|
111
|
+
</Text>
|
|
112
|
+
) : null}
|
|
113
|
+
</div>
|
|
114
|
+
{cta ? (
|
|
115
|
+
<div className="mt-2 flex items-end">
|
|
116
|
+
<Button
|
|
117
|
+
linkVariant="unstyled"
|
|
118
|
+
linkClassName="label1 flex items-center gap-2 text-text"
|
|
119
|
+
{...cta}
|
|
120
|
+
iconName="expand_circle_right"
|
|
121
|
+
iconFill={1}
|
|
122
|
+
/>
|
|
123
|
+
</div>
|
|
124
|
+
) : null}
|
|
125
|
+
</div>
|
|
126
|
+
</section>
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export default FullImageCard;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ButtonProps } from "../../button/types";
|
|
2
|
+
|
|
3
|
+
export type FullImageAsset = {
|
|
4
|
+
href: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type FullImageCardItem = {
|
|
11
|
+
anchorId?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
caption?: string;
|
|
15
|
+
cta?: ButtonProps;
|
|
16
|
+
link?: ButtonProps;
|
|
17
|
+
image?: FullImageAsset;
|
|
18
|
+
className?: string;
|
|
19
|
+
contentClassName?: string;
|
|
20
|
+
imageClassName?: string;
|
|
21
|
+
/** Applies `shadow-card` to the outer card element. */
|
|
22
|
+
shadow?: boolean;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type FullImageCardProps = {
|
|
26
|
+
card: FullImageCardItem;
|
|
27
|
+
lgWidth?: string;
|
|
28
|
+
mdWidth?: string;
|
|
29
|
+
};
|