@windstream/react-shared-components 0.1.70 → 0.1.72
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 +3 -3
- package/dist/contentful/index.esm.js.map +1 -1
- package/dist/contentful/index.js +3 -3
- package/dist/contentful/index.js.map +1 -1
- package/dist/core.d.ts +2 -2
- package/dist/index.d.ts +4 -4
- 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/address-input-banner/index.tsx +5 -5
- 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/blogs-grid-base/types.ts +1 -0
- 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/cart-retention-banner/types.ts +2 -2
- package/src/contentful/blocks/comparison-table/index.tsx +5 -3
- package/src/contentful/blocks/email-input-block/index.tsx +1 -2
- package/src/contentful/blocks/footer/Footer.stories.tsx +145 -32
- package/src/contentful/index.ts +1 -2
- package/src/hooks/contentful/use-contentful-rich-text.tsx +9 -10
- package/src/utils/index.ts +3 -0
- package/src/utils/speed-card-bg.ts +24 -0
|
@@ -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
|
+
};
|
|
@@ -2,87 +2,323 @@ import React from "react";
|
|
|
2
2
|
import { Button } from "../../button";
|
|
3
3
|
import { backgroundColorMap, Item, SimpleCardProps } from "./types";
|
|
4
4
|
|
|
5
|
+
import { Link } from "@shared/components/link";
|
|
6
|
+
import { MaterialIcon } from "@shared/components/material-icon";
|
|
5
7
|
import { NextImage } from "@shared/components/next-image";
|
|
6
8
|
import { Text } from "@shared/components/text";
|
|
9
|
+
import { cx } from "@shared/utils";
|
|
10
|
+
import { SpeedCardBg } from "@shared/utils/speed-card-bg";
|
|
11
|
+
|
|
12
|
+
const ICON_SIZE = 60;
|
|
13
|
+
|
|
14
|
+
const alignmentClasses: Record<string, string> = {
|
|
15
|
+
left: "flex w-full justify-start",
|
|
16
|
+
right: "flex w-full justify-end",
|
|
17
|
+
center: "flex w-full justify-center",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const justifyClass: Record<string, string> = {
|
|
21
|
+
left: "justify-start",
|
|
22
|
+
right: "justify-end",
|
|
23
|
+
center: "justify-center",
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const formatPhoneHref = (phone: string): string => {
|
|
27
|
+
const digits = (phone || "").replace(/\D/g, "");
|
|
28
|
+
return digits ? `tel:${digits}` : "";
|
|
29
|
+
};
|
|
7
30
|
|
|
8
31
|
export const SimpleCard: React.FC<SimpleCardProps> = ({
|
|
9
32
|
card,
|
|
10
33
|
lgWidth,
|
|
11
34
|
mdWidth,
|
|
35
|
+
className,
|
|
36
|
+
contentClassName,
|
|
37
|
+
style,
|
|
12
38
|
}) => {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const view = card.imageView?.toLowerCase();
|
|
40
|
+
const fullSizeImage = view === "full";
|
|
41
|
+
const marginSizeImage = view === "margin";
|
|
42
|
+
const standardSizeImage = view === "standard";
|
|
43
|
+
const iconSizeImage =
|
|
44
|
+
view === "icon" || view === "inset" || (!view && !!card.image);
|
|
45
|
+
|
|
46
|
+
// Local @ui CalloutCard treats "standard" + "icon" as the new card design
|
|
47
|
+
// that supports background color / pinwheel / inverted text via CSS vars.
|
|
48
|
+
const hasNewDesign = standardSizeImage || iconSizeImage;
|
|
49
|
+
|
|
50
|
+
const iconAlignment =
|
|
51
|
+
card.iconAlignment?.toLowerCase() ||
|
|
52
|
+
card.imageAlignment?.toLowerCase() ||
|
|
53
|
+
"left";
|
|
54
|
+
|
|
55
|
+
const ctaAlignmentClass =
|
|
56
|
+
(card.ctaAlignment && alignmentClasses[card.ctaAlignment]) ||
|
|
57
|
+
alignmentClasses.left;
|
|
58
|
+
const ctaAlignmentBottomClass =
|
|
59
|
+
(card.ctaAlignmentBottom && justifyClass[card.ctaAlignmentBottom]) ||
|
|
60
|
+
justifyClass.left;
|
|
61
|
+
|
|
62
|
+
const pinwheelColorCode = card.pinwheelColor?.split("-")[1];
|
|
63
|
+
|
|
64
|
+
const useDynamicColors = hasNewDesign && card.applyCardBackgroundColor;
|
|
65
|
+
|
|
66
|
+
const dynamicStyle: React.CSSProperties = {
|
|
67
|
+
...style,
|
|
68
|
+
...(useDynamicColors && card.backgroundColor
|
|
69
|
+
? ({ ["--scc-bg" as any]: card.backgroundColor } as React.CSSProperties)
|
|
70
|
+
: {}),
|
|
71
|
+
...(useDynamicColors && card.textColor
|
|
72
|
+
? ({ ["--scc-fg" as any]: card.textColor } as React.CSSProperties)
|
|
73
|
+
: {}),
|
|
74
|
+
...(useDynamicColors && card.backgroundColor
|
|
75
|
+
? { backgroundColor: "var(--scc-bg)" }
|
|
76
|
+
: {}),
|
|
77
|
+
...(useDynamicColors && card.showBackgroundImage && pinwheelColorCode
|
|
78
|
+
? {
|
|
79
|
+
backgroundImage: `url('data:image/svg+xml;utf8,${encodeURIComponent(
|
|
80
|
+
SpeedCardBg(pinwheelColorCode)
|
|
81
|
+
)}')`,
|
|
82
|
+
backgroundPosition: "top left",
|
|
83
|
+
backgroundSize: "684px 107px",
|
|
84
|
+
backgroundRepeat: "no-repeat",
|
|
85
|
+
}
|
|
86
|
+
: {}),
|
|
42
87
|
};
|
|
43
88
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
89
|
+
const renderFullImage = (margin: boolean) => {
|
|
90
|
+
if (!card.image) return null;
|
|
91
|
+
return (
|
|
92
|
+
<div
|
|
93
|
+
className={cx(
|
|
94
|
+
"relative aspect-video overflow-hidden",
|
|
95
|
+
!margin ? "rounded-t-3xl" : "mx-6 lg:mx-8"
|
|
96
|
+
)}
|
|
97
|
+
>
|
|
98
|
+
<NextImage
|
|
99
|
+
src={card.image}
|
|
100
|
+
alt={card.imageAlt ?? card.title ?? "card-image"}
|
|
101
|
+
width={card.imageWidth || 400}
|
|
102
|
+
height={card.imageHeight || 280}
|
|
103
|
+
className={cx("w-full", !margin && "rounded-t-3xl")}
|
|
104
|
+
/>
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const renderIcon = () => {
|
|
110
|
+
if (!card.image) return null;
|
|
111
|
+
const imgWidth = standardSizeImage
|
|
112
|
+
? card.imageWidth || ICON_SIZE
|
|
113
|
+
: ICON_SIZE;
|
|
114
|
+
const imgHeight = standardSizeImage
|
|
115
|
+
? card.imageHeight || ICON_SIZE
|
|
116
|
+
: ICON_SIZE;
|
|
117
|
+
return (
|
|
118
|
+
<div
|
|
119
|
+
className={cx(
|
|
120
|
+
"relative mb-8 flex",
|
|
121
|
+
card.imageToRichTextAlignment && "h-[60px] w-[60px] flex-shrink-0"
|
|
122
|
+
)}
|
|
123
|
+
style={{ justifyContent: iconAlignment }}
|
|
124
|
+
>
|
|
125
|
+
<NextImage
|
|
126
|
+
src={card.image}
|
|
127
|
+
alt={card.imageAlt ?? card.title ?? "card-icon"}
|
|
128
|
+
width={imgWidth}
|
|
129
|
+
height={imgHeight}
|
|
130
|
+
className={cx(
|
|
131
|
+
"object-contain",
|
|
132
|
+
card.imageToRichTextAlignment && "!h-[60px] !w-[60px]"
|
|
133
|
+
)}
|
|
134
|
+
/>
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const textColorStyle =
|
|
140
|
+
useDynamicColors && card.textColor ? { color: card.textColor } : undefined;
|
|
141
|
+
|
|
142
|
+
const titleNode = card.title ? (
|
|
143
|
+
<Text
|
|
144
|
+
as="h3"
|
|
145
|
+
className="heading6 mb-2 text-text md:heading6"
|
|
146
|
+
style={textColorStyle}
|
|
147
|
+
>
|
|
148
|
+
{card.title}
|
|
149
|
+
</Text>
|
|
150
|
+
) : null;
|
|
151
|
+
|
|
152
|
+
const titleWithLink =
|
|
153
|
+
card.cta?.href && titleNode ? (
|
|
154
|
+
<Link
|
|
155
|
+
href={card.cta.href}
|
|
156
|
+
target={card.cta.target}
|
|
157
|
+
className="no-underline hover:underline"
|
|
158
|
+
style={textColorStyle}
|
|
159
|
+
>
|
|
160
|
+
{titleNode}
|
|
161
|
+
</Link>
|
|
162
|
+
) : (
|
|
163
|
+
titleNode
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
const hasTable =
|
|
167
|
+
(card.workingHours?.length ?? 0) > 0 || (card.phoneNumber?.length ?? 0) > 0;
|
|
51
168
|
|
|
52
169
|
return (
|
|
53
|
-
<
|
|
54
|
-
className={
|
|
170
|
+
<section
|
|
171
|
+
className={cx(
|
|
172
|
+
"callout-card relative flex w-full flex-col rounded-3xl p-0",
|
|
173
|
+
card.shadow && "shadow-card",
|
|
174
|
+
card.image && !fullSizeImage && !card.showBackgroundImage && "pt-1",
|
|
175
|
+
!card.applyCardBackgroundColor &&
|
|
176
|
+
(backgroundColorMap[card.backgroundColor ?? ""] ?? ""),
|
|
177
|
+
mdWidth,
|
|
178
|
+
lgWidth,
|
|
179
|
+
className
|
|
180
|
+
)}
|
|
181
|
+
style={dynamicStyle}
|
|
182
|
+
aria-labelledby={card.title ? `callout-${card.title}` : undefined}
|
|
55
183
|
>
|
|
184
|
+
{/* Top "location" CTA */}
|
|
185
|
+
{card.ctaBottom?.title && card.ctaBottom?.href ? (
|
|
186
|
+
<div
|
|
187
|
+
className={cx(
|
|
188
|
+
"top-link m-6 flex items-center lg:m-8",
|
|
189
|
+
ctaAlignmentBottomClass
|
|
190
|
+
)}
|
|
191
|
+
>
|
|
192
|
+
<Link
|
|
193
|
+
href={card.ctaBottom.href}
|
|
194
|
+
className="label1 inline-flex items-center gap-2 text-text decoration-text underline-offset-4 hover:underline"
|
|
195
|
+
>
|
|
196
|
+
<MaterialIcon name="location_on" fill={1} size={24} />
|
|
197
|
+
<span>{card.ctaBottom.title}</span>
|
|
198
|
+
</Link>
|
|
199
|
+
</div>
|
|
200
|
+
) : null}
|
|
201
|
+
|
|
202
|
+
{card.image && fullSizeImage ? renderFullImage(false) : null}
|
|
203
|
+
{card.image && marginSizeImage ? renderFullImage(true) : null}
|
|
204
|
+
|
|
56
205
|
<div
|
|
57
|
-
className={
|
|
206
|
+
className={cx(
|
|
207
|
+
"relative flex flex-1 flex-col justify-between px-6 pb-8 pt-7 lg:px-8 lg:py-8",
|
|
208
|
+
contentClassName
|
|
209
|
+
)}
|
|
58
210
|
>
|
|
59
|
-
<div className="
|
|
211
|
+
<div className="flex flex-1 flex-col justify-between">
|
|
212
|
+
<div
|
|
213
|
+
className={cx(
|
|
214
|
+
"flex flex-col",
|
|
215
|
+
card.imageToRichTextAlignment &&
|
|
216
|
+
"lg:flex-row lg:items-start lg:gap-6"
|
|
217
|
+
)}
|
|
218
|
+
>
|
|
219
|
+
<div
|
|
220
|
+
className={cx(card.imageToRichTextAlignment && "flex-shrink-0")}
|
|
221
|
+
>
|
|
222
|
+
{card.image && !fullSizeImage && !marginSizeImage
|
|
223
|
+
? renderIcon()
|
|
224
|
+
: null}
|
|
225
|
+
</div>
|
|
226
|
+
<div className="flex flex-col gap-3 md:gap-4">
|
|
227
|
+
{titleWithLink}
|
|
60
228
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
{
|
|
70
|
-
|
|
71
|
-
|
|
229
|
+
{card.titleLocation ? (
|
|
230
|
+
<div className="mb-1 lg:mb-2">
|
|
231
|
+
<Text as="h4" className="label1 font-bold text-text">
|
|
232
|
+
{card.titleLocation}
|
|
233
|
+
</Text>
|
|
234
|
+
</div>
|
|
235
|
+
) : null}
|
|
236
|
+
|
|
237
|
+
{hasTable ? (
|
|
238
|
+
<div className="mb-2">
|
|
239
|
+
<table>
|
|
240
|
+
<tbody>
|
|
241
|
+
{card.workingHours?.map((hours, index) => {
|
|
242
|
+
const [label, value] = (hours ?? "").split("|");
|
|
243
|
+
return (
|
|
244
|
+
<tr key={`wh-${index}`}>
|
|
245
|
+
<td className="py-2 pr-3">
|
|
246
|
+
<Text className="label2 text-text">{label}</Text>
|
|
247
|
+
</td>
|
|
248
|
+
<td className="py-2 pl-3">
|
|
249
|
+
<Text className="body2 font-bold text-text">
|
|
250
|
+
{value}
|
|
251
|
+
</Text>
|
|
252
|
+
</td>
|
|
253
|
+
</tr>
|
|
254
|
+
);
|
|
255
|
+
})}
|
|
256
|
+
{card.phoneNumber?.map((phone, index) => (
|
|
257
|
+
<tr key={`ph-${index}`}>
|
|
258
|
+
<td className="py-1 pr-3 align-middle">
|
|
259
|
+
<MaterialIcon
|
|
260
|
+
fill={1}
|
|
261
|
+
name="call"
|
|
262
|
+
size={24}
|
|
263
|
+
weight="200"
|
|
264
|
+
className="text-text"
|
|
265
|
+
/>
|
|
266
|
+
</td>
|
|
267
|
+
<td className="py-1 pl-3">
|
|
268
|
+
<Link
|
|
269
|
+
href={formatPhoneHref(phone)}
|
|
270
|
+
className="text-inherit no-underline"
|
|
271
|
+
>
|
|
272
|
+
<Text className="body2 font-bold text-text">
|
|
273
|
+
{phone}
|
|
274
|
+
</Text>
|
|
275
|
+
</Link>
|
|
276
|
+
</td>
|
|
277
|
+
</tr>
|
|
278
|
+
))}
|
|
279
|
+
</tbody>
|
|
280
|
+
</table>
|
|
281
|
+
</div>
|
|
282
|
+
) : null}
|
|
283
|
+
|
|
284
|
+
{card.body ? (
|
|
285
|
+
<Text
|
|
286
|
+
as="div"
|
|
287
|
+
className="body1 text-text"
|
|
288
|
+
style={textColorStyle}
|
|
289
|
+
>
|
|
290
|
+
{card.body}
|
|
291
|
+
</Text>
|
|
292
|
+
) : null}
|
|
293
|
+
{card.richText ? (
|
|
294
|
+
<Text
|
|
295
|
+
as="div"
|
|
296
|
+
className="body1 text-text"
|
|
297
|
+
style={textColorStyle}
|
|
298
|
+
>
|
|
299
|
+
{card.richText}
|
|
300
|
+
</Text>
|
|
301
|
+
) : null}
|
|
302
|
+
</div>
|
|
303
|
+
</div>
|
|
72
304
|
</div>
|
|
73
|
-
|
|
74
|
-
|
|
305
|
+
|
|
306
|
+
{card.cta ? (
|
|
307
|
+
<div className={cx("mt-2", ctaAlignmentClass)}>
|
|
75
308
|
<Button
|
|
76
309
|
linkVariant="unstyled"
|
|
77
|
-
linkClassName=
|
|
310
|
+
linkClassName={cx(
|
|
311
|
+
"label1 flex items-center gap-2 text-text",
|
|
312
|
+
useDynamicColors && card.textColor && "decoration-current"
|
|
313
|
+
)}
|
|
78
314
|
{...card.cta}
|
|
79
|
-
iconName={"expand_circle_right"}
|
|
80
|
-
iconFill={1}
|
|
315
|
+
iconName={card.cta.iconName ?? "expand_circle_right"}
|
|
316
|
+
iconFill={card.cta.iconFill ?? 1}
|
|
81
317
|
/>
|
|
82
318
|
</div>
|
|
83
|
-
)}
|
|
319
|
+
) : null}
|
|
84
320
|
</div>
|
|
85
|
-
</
|
|
321
|
+
</section>
|
|
86
322
|
);
|
|
87
323
|
};
|
|
88
324
|
|