@windstream/react-shared-components 0.1.92 → 0.1.93
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 +1 -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/core.d.ts +1 -1
- package/dist/index.esm.js +5 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +5 -13
- 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/contentful/blocks/find-kinetic/index.tsx +10 -2
- package/src/contentful/blocks/find-kinetic/types.ts +1 -0
- package/src/contentful/blocks/navigation/Navigation.stories.mocks.tsx +78 -0
- package/src/contentful/blocks/navigation/Navigation.stories.tsx +138 -0
- package/src/contentful/blocks/navigation/desktop-link-groups.tsx/index.tsx +10 -8
- package/src/contentful/blocks/navigation/index.tsx +30 -29
- package/src/contentful/blocks/navigation/mobile-link-groups.tsx/index.tsx +2 -2
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export const PRIMARY_LINKS: any = [
|
|
2
|
+
{
|
|
3
|
+
__typename: "ComponentButton",
|
|
4
|
+
buttonLabel: "Home",
|
|
5
|
+
href: "/",
|
|
6
|
+
preserveQueryParameters: false,
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
__typename: "ComponentButton",
|
|
10
|
+
buttonLabel: "Products",
|
|
11
|
+
href: "/products",
|
|
12
|
+
preserveQueryParameters: false,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
__typename: "ComponentButtonGroup",
|
|
16
|
+
title: "Services",
|
|
17
|
+
items: {
|
|
18
|
+
items: [
|
|
19
|
+
{
|
|
20
|
+
__typename: "ComponentButton",
|
|
21
|
+
buttonLabel: "Internet",
|
|
22
|
+
href: "/internet",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
__typename: "ComponentButton",
|
|
26
|
+
buttonLabel: "Phone",
|
|
27
|
+
href: "/phone",
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
export const UTILITY_LINKS: any = [
|
|
35
|
+
{
|
|
36
|
+
__typename: "ComponentButton",
|
|
37
|
+
buttonLabel: "Residential",
|
|
38
|
+
href: "/residential",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
__typename: "ComponentButton",
|
|
42
|
+
buttonLabel: "Business",
|
|
43
|
+
href: "/business",
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
export const ACCOUNT_LINKS: any = [
|
|
49
|
+
{
|
|
50
|
+
__typename: "ComponentButtonGroup",
|
|
51
|
+
title: "My Account",
|
|
52
|
+
items: {
|
|
53
|
+
items: [
|
|
54
|
+
{
|
|
55
|
+
__typename: "ComponentButton",
|
|
56
|
+
buttonLabel: "Profile",
|
|
57
|
+
href: "/profile",
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
export const SUPPORT_LINKS: any = [
|
|
65
|
+
{
|
|
66
|
+
__typename: "ComponentButtonGroup",
|
|
67
|
+
title: "Support",
|
|
68
|
+
items: {
|
|
69
|
+
items: [
|
|
70
|
+
{
|
|
71
|
+
__typename: "ComponentButton",
|
|
72
|
+
buttonLabel: "Help",
|
|
73
|
+
href: "/help",
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
];
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { Navigation } from "./index";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { DocsPage } from "@shared/stories/DocsTemplate";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
PRIMARY_LINKS,
|
|
7
|
+
UTILITY_LINKS,
|
|
8
|
+
ACCOUNT_LINKS,
|
|
9
|
+
SUPPORT_LINKS,
|
|
10
|
+
} from "./Navigation.stories.mocks";
|
|
11
|
+
|
|
12
|
+
const meta: Meta<typeof Navigation> = {
|
|
13
|
+
title: "Contentful Blocks/Navigation",
|
|
14
|
+
component: Navigation,
|
|
15
|
+
tags: ["autodocs"],
|
|
16
|
+
|
|
17
|
+
parameters: {
|
|
18
|
+
docs: {
|
|
19
|
+
page: DocsPage,
|
|
20
|
+
description: {
|
|
21
|
+
component:
|
|
22
|
+
"Navigation component that includes utility navigation, main navigation, support/account links, search, and mobile drawer.",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
args: {
|
|
28
|
+
primaryNavigationLinks: PRIMARY_LINKS,
|
|
29
|
+
primaryNavigationLogo: undefined,
|
|
30
|
+
|
|
31
|
+
utilityNavigationLinks: UTILITY_LINKS,
|
|
32
|
+
accountNavigationLinks: ACCOUNT_LINKS,
|
|
33
|
+
supportNavigationLinks: SUPPORT_LINKS,
|
|
34
|
+
|
|
35
|
+
displayUtilityNavigation: true,
|
|
36
|
+
displaySearchBar: true,
|
|
37
|
+
displayCallNowCta: true,
|
|
38
|
+
|
|
39
|
+
showCallButton: true,
|
|
40
|
+
showMobileSliderMenu: true,
|
|
41
|
+
|
|
42
|
+
cartHref: "#",
|
|
43
|
+
displayCartIcon: true,
|
|
44
|
+
|
|
45
|
+
invocaPhoneNumberDisplayText: "1-855-654-0841",
|
|
46
|
+
callNowCtaText: "Call now:",
|
|
47
|
+
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
argTypes: {
|
|
51
|
+
displayUtilityNavigation: { control: "boolean" },
|
|
52
|
+
displaySearchBar: { control: "boolean" },
|
|
53
|
+
displayCallNowCta: { control: "boolean" },
|
|
54
|
+
|
|
55
|
+
navigationBackgroundColor: { control: "text" },
|
|
56
|
+
navigationLinkColor: { control: "text" },
|
|
57
|
+
|
|
58
|
+
cartHasRetention: { control: "boolean" },
|
|
59
|
+
|
|
60
|
+
onSearch: { action: "search triggered" },
|
|
61
|
+
onCartClick: { action: "cart clicked" },
|
|
62
|
+
onCallClickDesktop: { action: "call desktop" },
|
|
63
|
+
onCallClickMobile: { action: "call mobile" },
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default meta;
|
|
68
|
+
|
|
69
|
+
type Story = StoryObj<typeof meta>;
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
/* DEFAULT (ALL FEATURES) */
|
|
74
|
+
export const Default: Story = {};
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
/* WITHOUT UTILITY NAV */
|
|
79
|
+
export const WithoutUtilityNavigation: Story = {
|
|
80
|
+
args: {
|
|
81
|
+
displayUtilityNavigation: false,
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
/* WITHOUT SEARCH */
|
|
88
|
+
export const WithoutSearchBar: Story = {
|
|
89
|
+
args: {
|
|
90
|
+
displaySearchBar: false,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
/* WITHOUT CALL CTA */
|
|
97
|
+
export const WithoutCallCTA: Story = {
|
|
98
|
+
args: {
|
|
99
|
+
displayCallNowCta: false,
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
/* CART RETENTION DOT */
|
|
106
|
+
export const WithCartRetentionDot: Story = {
|
|
107
|
+
args: {
|
|
108
|
+
cartHasRetention: true,
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
/* CUSTOM BACKGROUND */
|
|
115
|
+
export const CustomBackgroundColor: Story = {
|
|
116
|
+
args: {
|
|
117
|
+
navigationBackgroundColor: "bg-blue-500",
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
/* CUSTOM LINK COLOR */
|
|
124
|
+
export const CustomLinkColor: Story = {
|
|
125
|
+
args: {
|
|
126
|
+
navigationLinkColor: "text-red-500",
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
/* MOBILE VIEW */
|
|
132
|
+
export const MobileView: Story = {
|
|
133
|
+
parameters: {
|
|
134
|
+
viewport: {
|
|
135
|
+
defaultViewport: "mobile1",
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
};
|
|
@@ -51,15 +51,16 @@ export const DesktopLinkGroups: React.FC<LinkGroupsProps> = ({
|
|
|
51
51
|
<Button
|
|
52
52
|
key={`submenu-link-btn-${link.anchorId}`}
|
|
53
53
|
{...link}
|
|
54
|
+
showButtonAs="text"
|
|
54
55
|
linkClassName={cx(
|
|
55
|
-
"body3 flex items-center
|
|
56
|
+
"body3 inline-flex items-center no-underline hover:underline",
|
|
56
57
|
linkColorClassName || "text-text"
|
|
57
58
|
)}
|
|
58
|
-
linkVariant="unstyled"
|
|
59
59
|
/>
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
|
|
63
64
|
// Group
|
|
64
65
|
const { anchorId, title, items } = link;
|
|
65
66
|
const subMenu = Array.isArray(items?.items) ? items!.items! : [];
|
|
@@ -75,19 +76,20 @@ export const DesktopLinkGroups: React.FC<LinkGroupsProps> = ({
|
|
|
75
76
|
onClick={() => setIsOpen(prev => !prev)}
|
|
76
77
|
aria-expanded={isOpen}
|
|
77
78
|
buttonClassName={cx(
|
|
78
|
-
"group body3 flex h-full
|
|
79
|
+
"group body3 flex items-center h-full",
|
|
79
80
|
linkColorClassName || "text-text"
|
|
80
81
|
)}
|
|
81
82
|
key={anchorId}
|
|
82
|
-
showButtonAs="unstyled"
|
|
83
|
+
showButtonAs="unstyled"
|
|
83
84
|
>
|
|
84
|
-
|
|
85
|
+
|
|
86
|
+
<Text as="span" className="group-hover:underline leading-none">
|
|
85
87
|
{title ?? null}
|
|
86
88
|
</Text>
|
|
87
89
|
<MaterialIcon
|
|
88
90
|
weight="200"
|
|
89
91
|
size={24}
|
|
90
|
-
className="text-icon-secondary group-hover:opacity-50"
|
|
92
|
+
className="text-icon-secondary group-hover:opacity-50 mt-[1px]"
|
|
91
93
|
name={isOpen ? "keyboard_arrow_up" : "keyboard_arrow_down"}
|
|
92
94
|
/>
|
|
93
95
|
</Button>
|
|
@@ -126,8 +128,8 @@ export const DesktopLinkGroups: React.FC<LinkGroupsProps> = ({
|
|
|
126
128
|
<li key={`submenu-link-${index}`} className="submenu-link">
|
|
127
129
|
<Button
|
|
128
130
|
{...site}
|
|
129
|
-
|
|
130
|
-
linkClassName="body3 px-
|
|
131
|
+
showButtonAs="text"
|
|
132
|
+
linkClassName="body3 px-3 flex items-center text-text-link no-underline hover:underline hover:bg-bg-surface-hover"
|
|
131
133
|
/>
|
|
132
134
|
</li>
|
|
133
135
|
);
|
|
@@ -31,7 +31,7 @@ export const Navigation: React.FC<NavigationProps> = props => {
|
|
|
31
31
|
onCallClickDesktop,
|
|
32
32
|
onCallClickMobile,
|
|
33
33
|
onCartClick,
|
|
34
|
-
onSearch = () => {},
|
|
34
|
+
onSearch = () => { },
|
|
35
35
|
utilityNavActiveIndex,
|
|
36
36
|
primaryNavigationLogoWidth = 76.5,
|
|
37
37
|
primaryNavigationLogoHeight = 24,
|
|
@@ -111,17 +111,18 @@ export const Navigation: React.FC<NavigationProps> = props => {
|
|
|
111
111
|
<nav className={`menu-container z-[1000]`}>
|
|
112
112
|
{displayUtilityNavigation ? (
|
|
113
113
|
<div className="utility-container hidden lg:block lg:border-b lg:px-2">
|
|
114
|
-
<div className="mx-auto flex max-w-120 justify-between">
|
|
114
|
+
<div className="mx-auto flex max-w-120 items-center justify-between">
|
|
115
115
|
<ul className="flex gap-5" aria-label="Utility Navigation">
|
|
116
116
|
{utilityNavigationLinks?.map((links, index) => {
|
|
117
117
|
return (
|
|
118
118
|
<li key={`main-menu-items-${index}`}>
|
|
119
119
|
<ContentfulButton
|
|
120
|
+
showButtonAs="text"
|
|
120
121
|
linkClassName={cx(
|
|
121
|
-
"footnote flex items-center
|
|
122
|
+
"footnote inline-flex items-center text-text",
|
|
122
123
|
// If utilityNavActiveIndex is not provided, default to making the second link active (for existing business app). If utilityNavActiveIndex is provided, use it to determine which link is active.
|
|
123
124
|
typeof utilityNavActiveIndex !== "number"
|
|
124
|
-
? index ===
|
|
125
|
+
? index === 0 && "label4"
|
|
125
126
|
: utilityNavActiveIndex === index && "label4"
|
|
126
127
|
)}
|
|
127
128
|
linkVariant="unstyled"
|
|
@@ -141,7 +142,7 @@ export const Navigation: React.FC<NavigationProps> = props => {
|
|
|
141
142
|
prefix={callNowCtaText}
|
|
142
143
|
onClick={onCallClickDesktop}
|
|
143
144
|
>
|
|
144
|
-
<Text className="body3 text-text">
|
|
145
|
+
<Text className="body3 text-text ml-1">
|
|
145
146
|
{invocaPhoneNumberDisplayText}
|
|
146
147
|
</Text>
|
|
147
148
|
</CallButton>
|
|
@@ -149,14 +150,15 @@ export const Navigation: React.FC<NavigationProps> = props => {
|
|
|
149
150
|
{displayCartIcon ? (
|
|
150
151
|
<Link
|
|
151
152
|
href={cartHref || "#"}
|
|
152
|
-
className="relative
|
|
153
|
+
className="relative flex items-center justify-center"
|
|
153
154
|
aria-label={cartIconAriaLabel}
|
|
154
155
|
onClick={onCartClick}
|
|
155
156
|
>
|
|
156
|
-
<
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
<span className="text-[20px]">🛒</span>
|
|
158
|
+
|
|
159
|
+
{cartHasRetention && (
|
|
160
|
+
<span className="absolute -right-1 -top-1 h-2 w-2 rounded-full bg-icon-brand" />
|
|
161
|
+
)}
|
|
160
162
|
</Link>
|
|
161
163
|
) : null}
|
|
162
164
|
{accountNavigationLinks?.map((links, index) => {
|
|
@@ -244,7 +246,7 @@ export const Navigation: React.FC<NavigationProps> = props => {
|
|
|
244
246
|
</Link>
|
|
245
247
|
) : null}
|
|
246
248
|
|
|
247
|
-
<div className="flex h-
|
|
249
|
+
<div className="flex h-14 items-center gap-6">
|
|
248
250
|
{primaryNavigationLinks?.map((links, index) => {
|
|
249
251
|
return (
|
|
250
252
|
<DesktopLinkGroups
|
|
@@ -257,9 +259,9 @@ export const Navigation: React.FC<NavigationProps> = props => {
|
|
|
257
259
|
})}
|
|
258
260
|
</div>
|
|
259
261
|
</div>
|
|
260
|
-
<div className="flex h-full items-center gap-
|
|
262
|
+
<div className="flex h-full items-center gap-6">
|
|
261
263
|
{showCallNowCtaInMainNav &&
|
|
262
|
-
|
|
264
|
+
!(displayUtilityNavigation && displayCallNowCta)
|
|
263
265
|
? renderMainNavCallCta(onCallClickDesktop)
|
|
264
266
|
: null}
|
|
265
267
|
{displaySearchBar ? (
|
|
@@ -415,7 +417,7 @@ const MobileMenu = (props: NavigationProps) => {
|
|
|
415
417
|
? props.searchBarIcon
|
|
416
418
|
: props.searchBarIcon?.url || ""
|
|
417
419
|
}
|
|
418
|
-
onSearch={props.onSearch || (() => {})}
|
|
420
|
+
onSearch={props.onSearch || (() => { })}
|
|
419
421
|
/>
|
|
420
422
|
) : null}
|
|
421
423
|
<div
|
|
@@ -503,11 +505,11 @@ const MobileSearchInput = (props: {
|
|
|
503
505
|
>
|
|
504
506
|
<NextImage
|
|
505
507
|
src={searchBarIconURL}
|
|
506
|
-
width={
|
|
507
|
-
height={
|
|
508
|
+
width={16}
|
|
509
|
+
height={16}
|
|
510
|
+
className="mr-2"
|
|
508
511
|
alt="Search icon"
|
|
509
512
|
role="button"
|
|
510
|
-
className="ml-2"
|
|
511
513
|
onClick={redirectToSearchResults}
|
|
512
514
|
/>
|
|
513
515
|
<div className="flex-grow">
|
|
@@ -542,26 +544,25 @@ const DesktopSearchInput = (props: {
|
|
|
542
544
|
return (
|
|
543
545
|
<form
|
|
544
546
|
name="searchForm"
|
|
545
|
-
className="flex h-
|
|
547
|
+
className="flex items-center h-10 w-80 rounded-full border border-gray-500 bg-white px-5 shadow-sm"
|
|
546
548
|
onSubmit={redirectToSearchResults}
|
|
547
549
|
>
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
alt="Search icon"
|
|
553
|
-
role="button"
|
|
554
|
-
onClick={redirectToSearchResults}
|
|
550
|
+
{/* Search Icon */}
|
|
551
|
+
<MaterialIcon
|
|
552
|
+
name="search"
|
|
553
|
+
className="text-gray-500 mr-2 text-[18px]"
|
|
555
554
|
/>
|
|
556
|
-
|
|
555
|
+
|
|
556
|
+
{/* Input */}
|
|
557
|
+
<input
|
|
557
558
|
ref={searchInputRef}
|
|
558
|
-
|
|
559
|
+
type="text"
|
|
559
560
|
name="search"
|
|
560
561
|
placeholder="Search..."
|
|
561
562
|
value={searchValue}
|
|
562
|
-
onChange={e => setSearchValue(e.target.value)}
|
|
563
|
+
onChange={(e) => setSearchValue(e.target.value)}
|
|
564
|
+
className="flex-1 bg-transparent outline-none text-sm text-gray-700"
|
|
563
565
|
autoComplete="off"
|
|
564
|
-
containerClassName="px-0 h-full border-none rounded-full"
|
|
565
566
|
/>
|
|
566
567
|
</form>
|
|
567
568
|
);
|
|
@@ -31,7 +31,7 @@ export const MobileLinkGroups: React.FC<LinkGroupsProps> = ({ link }) => {
|
|
|
31
31
|
<Button
|
|
32
32
|
key={`submenu-link-btn-${link.anchorId}`}
|
|
33
33
|
{...link}
|
|
34
|
-
linkClassName="label3 flex items-center
|
|
34
|
+
linkClassName="label3 flex items-center px-4 text-text-link"
|
|
35
35
|
linkVariant="unstyled"
|
|
36
36
|
/>
|
|
37
37
|
);
|
|
@@ -46,7 +46,7 @@ export const MobileLinkGroups: React.FC<LinkGroupsProps> = ({ link }) => {
|
|
|
46
46
|
<Button
|
|
47
47
|
onClick={() => setIsOpen(prev => !prev)}
|
|
48
48
|
aria-expanded={isOpen}
|
|
49
|
-
buttonClassName="label3 flex
|
|
49
|
+
buttonClassName=" label3 flex items-center px-4"
|
|
50
50
|
key={anchorId}
|
|
51
51
|
showButtonAs="unstyled"
|
|
52
52
|
>
|