@windstream/react-shared-components 0.1.97 → 0.1.99
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 +5 -0
- 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/index.d.ts +1 -1
- package/dist/index.esm.js +13 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/dist/next/index.esm.js +2 -2
- package/dist/next/index.esm.js.map +1 -1
- package/dist/next/index.js +2 -2
- package/dist/next/index.js.map +1 -1
- package/dist/styles.css +1 -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/brand-button/index.tsx +1 -1
- package/src/contentful/blocks/breadcrumbs/index.tsx +2 -2
- package/src/contentful/blocks/button/index.tsx +24 -3
- package/src/contentful/blocks/button/types.ts +1 -0
- package/src/contentful/blocks/email-input-block/index.tsx +16 -7
- package/src/contentful/blocks/find-kinetic/index.tsx +61 -35
- package/src/contentful/blocks/find-kinetic/types.ts +1 -0
- package/src/contentful/blocks/image-promo-bar/helper.tsx +1 -1
- package/src/contentful/blocks/image-promo-bar/index.tsx +38 -10
- package/src/contentful/blocks/image-promo-bar/types.ts +3 -0
- package/src/contentful/blocks/image-promo-bar/youtube-embed.tsx +1 -1
- package/src/contentful/blocks/navigation/desktop-link-groups.tsx/index.tsx +139 -141
- package/src/contentful/blocks/navigation/index.tsx +571 -569
- package/src/contentful/blocks/navigation/mobile-link-groups.tsx/index.tsx +82 -82
- package/src/contentful/blocks/shape-background-wrapper/index.tsx +5 -2
- package/src/hooks/contentful/use-contentful-rich-text.tsx +6 -2
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { MaterialIcon } from "@shared/components/material-icon";
|
|
4
|
-
import { Button } from "@shared/contentful/blocks/button";
|
|
5
|
-
import { ButtonProps as ContentfulButtonProps } from "@shared/contentful/blocks/button/types";
|
|
6
|
-
|
|
7
|
-
type ComponentButtonGroup = {
|
|
8
|
-
anchorId?: string | null;
|
|
9
|
-
title?: string | null;
|
|
10
|
-
items?: { items?: ContentfulButtonProps[] | null } | null;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
type Link = ContentfulButtonProps | ComponentButtonGroup;
|
|
14
|
-
|
|
15
|
-
type LinkGroupsProps = {
|
|
16
|
-
link?: Link;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const isButton = (link: Link): link is ContentfulButtonProps => {
|
|
20
|
-
// If your group never has `href`, this is a simple and effective guard
|
|
21
|
-
return typeof (link as ContentfulButtonProps).href === "string";
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const MobileLinkGroups: React.FC<LinkGroupsProps> = ({ link }) => {
|
|
25
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
26
|
-
if (!link) return null;
|
|
27
|
-
|
|
28
|
-
// Single button
|
|
29
|
-
if (isButton(link)) {
|
|
30
|
-
return (
|
|
31
|
-
<Button
|
|
32
|
-
key={`submenu-link-btn-${link.anchorId}`}
|
|
33
|
-
{...link}
|
|
34
|
-
linkClassName="label3 flex items-center px-4 text-text-link"
|
|
35
|
-
linkVariant="unstyled"
|
|
36
|
-
/>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Group
|
|
41
|
-
const { anchorId, title, items } = link;
|
|
42
|
-
const subMenu = Array.isArray(items?.items) ? items!.items! : [];
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<>
|
|
46
|
-
<Button
|
|
47
|
-
onClick={() => setIsOpen(prev => !prev)}
|
|
48
|
-
aria-expanded={isOpen}
|
|
49
|
-
buttonClassName=" label3 flex items-center px-4"
|
|
50
|
-
key={anchorId}
|
|
51
|
-
showButtonAs="unstyled"
|
|
52
|
-
>
|
|
53
|
-
{title ?? null}
|
|
54
|
-
<MaterialIcon
|
|
55
|
-
weight="200"
|
|
56
|
-
size={24}
|
|
57
|
-
className="
|
|
58
|
-
name={isOpen ? "keyboard_arrow_up" : "keyboard_arrow_down"}
|
|
59
|
-
/>
|
|
60
|
-
</Button>
|
|
61
|
-
{isOpen && subMenu.length > 0 && <RenderSubMenu items={subMenu} />}
|
|
62
|
-
</>
|
|
63
|
-
);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const RenderSubMenu: React.FC<{ items: ContentfulButtonProps[] }> = ({
|
|
67
|
-
items,
|
|
68
|
-
}) => (
|
|
69
|
-
<ul key={`submenu-${items.length}`} className="flex flex-col gap-2">
|
|
70
|
-
{items.map((site, index) => {
|
|
71
|
-
return (
|
|
72
|
-
<li key={`submenu-link-${index}`} className="submenu-link">
|
|
73
|
-
<Button
|
|
74
|
-
{...site}
|
|
75
|
-
linkVariant="unstyled"
|
|
76
|
-
linkClassName="body3 pl-8 pr-4 flex items-center w-full h-11 text-text-link"
|
|
77
|
-
/>
|
|
78
|
-
</li>
|
|
79
|
-
);
|
|
80
|
-
})}
|
|
81
|
-
</ul>
|
|
82
|
-
);
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { MaterialIcon } from "@shared/components/material-icon";
|
|
4
|
+
import { Button } from "@shared/contentful/blocks/button";
|
|
5
|
+
import { ButtonProps as ContentfulButtonProps } from "@shared/contentful/blocks/button/types";
|
|
6
|
+
|
|
7
|
+
type ComponentButtonGroup = {
|
|
8
|
+
anchorId?: string | null;
|
|
9
|
+
title?: string | null;
|
|
10
|
+
items?: { items?: ContentfulButtonProps[] | null } | null;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type Link = ContentfulButtonProps | ComponentButtonGroup;
|
|
14
|
+
|
|
15
|
+
type LinkGroupsProps = {
|
|
16
|
+
link?: Link;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const isButton = (link: Link): link is ContentfulButtonProps => {
|
|
20
|
+
// If your group never has `href`, this is a simple and effective guard
|
|
21
|
+
return typeof (link as ContentfulButtonProps).href === "string";
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const MobileLinkGroups: React.FC<LinkGroupsProps> = ({ link }) => {
|
|
25
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
26
|
+
if (!link) return null;
|
|
27
|
+
|
|
28
|
+
// Single button
|
|
29
|
+
if (isButton(link)) {
|
|
30
|
+
return (
|
|
31
|
+
<Button
|
|
32
|
+
key={`submenu-link-btn-${link.anchorId}`}
|
|
33
|
+
{...link}
|
|
34
|
+
linkClassName="label3 flex items-center w-full h-11 px-4 text-text-link"
|
|
35
|
+
linkVariant="unstyled"
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Group
|
|
41
|
+
const { anchorId, title, items } = link;
|
|
42
|
+
const subMenu = Array.isArray(items?.items) ? items!.items! : [];
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<>
|
|
46
|
+
<Button
|
|
47
|
+
onClick={() => setIsOpen(prev => !prev)}
|
|
48
|
+
aria-expanded={isOpen}
|
|
49
|
+
buttonClassName=" label3 flex items-center w-full h-11 px-4"
|
|
50
|
+
key={anchorId}
|
|
51
|
+
showButtonAs="unstyled"
|
|
52
|
+
>
|
|
53
|
+
{title ?? null}
|
|
54
|
+
<MaterialIcon
|
|
55
|
+
weight="200"
|
|
56
|
+
size={24}
|
|
57
|
+
className="group-hover:opacity-50 text-icon-secondary"
|
|
58
|
+
name={isOpen ? "keyboard_arrow_up" : "keyboard_arrow_down"}
|
|
59
|
+
/>
|
|
60
|
+
</Button>
|
|
61
|
+
{isOpen && subMenu.length > 0 && <RenderSubMenu items={subMenu} />}
|
|
62
|
+
</>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const RenderSubMenu: React.FC<{ items: ContentfulButtonProps[] }> = ({
|
|
67
|
+
items,
|
|
68
|
+
}) => (
|
|
69
|
+
<ul key={`submenu-${items.length}`} className="flex flex-col gap-2">
|
|
70
|
+
{items.map((site, index) => {
|
|
71
|
+
return (
|
|
72
|
+
<li key={`submenu-link-${index}`} className="submenu-link type2">
|
|
73
|
+
<Button
|
|
74
|
+
{...site}
|
|
75
|
+
linkVariant="unstyled"
|
|
76
|
+
linkClassName="body3 pl-8 pr-4 flex items-center w-full h-11 text-text-link"
|
|
77
|
+
/>
|
|
78
|
+
</li>
|
|
79
|
+
);
|
|
80
|
+
})}
|
|
81
|
+
</ul>
|
|
82
|
+
);
|
|
@@ -46,7 +46,10 @@ export const ShapeBackgroundWrapper: React.FC<ShapeBackgroundWrapperProps> = ({
|
|
|
46
46
|
|
|
47
47
|
if (!show) {
|
|
48
48
|
return (
|
|
49
|
-
<div
|
|
49
|
+
<div
|
|
50
|
+
className={`shared-component-backgound-wrapper ${className ?? ""} ${bgClass ?? ""}`}
|
|
51
|
+
style={bgStyle}
|
|
52
|
+
>
|
|
50
53
|
{children}
|
|
51
54
|
</div>
|
|
52
55
|
);
|
|
@@ -54,7 +57,7 @@ export const ShapeBackgroundWrapper: React.FC<ShapeBackgroundWrapperProps> = ({
|
|
|
54
57
|
|
|
55
58
|
return (
|
|
56
59
|
<div
|
|
57
|
-
className={`shape-bg relative overflow-hidden ${className ?? ""} ${maxFit ? "max-content" : ""} ${
|
|
60
|
+
className={`shared-component-backgound-wrapper shape-bg relative overflow-hidden ${className ?? ""} ${maxFit ? "max-content" : ""} ${
|
|
58
61
|
bgClass ?? (!bgStyle ? "bg-white" : "")
|
|
59
62
|
}`}
|
|
60
63
|
style={bgStyle}
|
|
@@ -60,8 +60,12 @@ const defaultOptions: Options = {
|
|
|
60
60
|
</Text>
|
|
61
61
|
),
|
|
62
62
|
[BLOCKS.QUOTE]: (_node, children) => <blockquote>{children}</blockquote>,
|
|
63
|
-
[BLOCKS.UL_LIST]: (_node, children) =>
|
|
64
|
-
|
|
63
|
+
[BLOCKS.UL_LIST]: (_node, children) => (
|
|
64
|
+
<ul className="list-disc pl-6">{children}</ul>
|
|
65
|
+
),
|
|
66
|
+
[BLOCKS.OL_LIST]: (_node, children) => (
|
|
67
|
+
<ol className="list-decimal pl-6">{children}</ol>
|
|
68
|
+
),
|
|
65
69
|
[BLOCKS.LIST_ITEM]: (_node, children) => <li>{children}</li>,
|
|
66
70
|
|
|
67
71
|
[INLINES.HYPERLINK]: (node, children) => {
|