@windstream/react-shared-components 0.0.28 → 0.0.29
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/README.md +7 -0
- package/dist/contentful/index.d.ts +22 -4
- package/dist/contentful/index.esm.js +1 -1
- package/dist/contentful/index.esm.js.map +1 -1
- package/dist/contentful/index.js +1 -1
- package/dist/contentful/index.js.map +1 -1
- package/package.json +1 -1
- package/src/contentful/blocks/footer/index.tsx +5 -5
- package/src/contentful/blocks/navigation/Navigation.stories.tsx +1 -1
- package/src/contentful/blocks/navigation/index.tsx +51 -7
- package/src/contentful/blocks/navigation/link-groups.tsx/index.tsx +64 -0
- package/src/contentful/blocks/navigation/types.ts +21 -1
package/package.json
CHANGED
|
@@ -27,15 +27,15 @@ export const Footer: React.FC<FooterProps> = ({
|
|
|
27
27
|
<div key={`footer-link-group-${index}`}>
|
|
28
28
|
<div className="site-links-group" key={`link-group-${index}`}>
|
|
29
29
|
<div>{link?.title}</div>
|
|
30
|
-
<
|
|
31
|
-
{link?.
|
|
30
|
+
<ul className="flex flex-col">
|
|
31
|
+
{link?.items?.items?.map(
|
|
32
32
|
(site: any, _index: number) => (
|
|
33
|
-
<
|
|
33
|
+
<li className="pt-3" key={`site-links-${_index}`}>
|
|
34
34
|
<Button {...site} />
|
|
35
|
-
</
|
|
35
|
+
</li>
|
|
36
36
|
)
|
|
37
37
|
)}
|
|
38
|
-
</
|
|
38
|
+
</ul>
|
|
39
39
|
</div>
|
|
40
40
|
<div
|
|
41
41
|
className={
|
|
@@ -1,11 +1,55 @@
|
|
|
1
|
+
import { LinkGroups } from "./link-groups.tsx";
|
|
1
2
|
import { NavigationProps } from "./types";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import React from "react";
|
|
4
|
+
export const Navigation: React.FC<NavigationProps> = ({
|
|
5
|
+
// accountNavigationLinks,
|
|
6
|
+
// callNowCtaIcon,
|
|
7
|
+
// callNowCtaText,
|
|
8
|
+
// displayCallNowCta,
|
|
9
|
+
// displaySearchBar,
|
|
10
|
+
// displayUtilityNavigation,
|
|
11
|
+
// navigationBackgroundColor,
|
|
12
|
+
primaryNavigationLinks,
|
|
13
|
+
// primaryNavigationLogo,
|
|
14
|
+
// searchBarIcon,
|
|
15
|
+
// searchBarPlaceholder,
|
|
16
|
+
// showCallButton,
|
|
17
|
+
// showCallNowCtaInMainNav,
|
|
18
|
+
// showMobileSliderMenu,
|
|
19
|
+
// supportNavigationLinks,
|
|
20
|
+
// utilityNavBackgroundColor,
|
|
21
|
+
// utilityNavLinkColor,
|
|
22
|
+
utilityNavigationLinks,
|
|
23
|
+
maxWidth = true,
|
|
7
24
|
}) => {
|
|
8
|
-
return
|
|
25
|
+
return (
|
|
26
|
+
<div className="component-container">
|
|
27
|
+
<div className={`menu-container ${maxWidth ? "mx-auto max-w-120" : ""}`}>
|
|
28
|
+
<div className="utility-container">
|
|
29
|
+
<ul className="flex">
|
|
30
|
+
{utilityNavigationLinks?.map((links, index) => {
|
|
31
|
+
return (
|
|
32
|
+
<li key={`main-menu-items-${index}`}>
|
|
33
|
+
<LinkGroups link={links} />
|
|
34
|
+
</li>
|
|
35
|
+
);
|
|
36
|
+
})}
|
|
37
|
+
</ul>
|
|
38
|
+
</div>
|
|
39
|
+
<div className="main-nav-container">
|
|
40
|
+
<ul className="flex">
|
|
41
|
+
{primaryNavigationLinks?.map((links, index) => {
|
|
42
|
+
return (
|
|
43
|
+
<li key={`main-menu-items-${index}`}>
|
|
44
|
+
<LinkGroups link={links} />
|
|
45
|
+
</li>
|
|
46
|
+
);
|
|
47
|
+
})}
|
|
48
|
+
</ul>
|
|
49
|
+
</div>
|
|
50
|
+
<div></div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
9
54
|
};
|
|
10
|
-
|
|
11
55
|
export default Navigation;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
ButtonProps as ContentfulButtonProps,
|
|
5
|
+
} from "@shared/contentful";
|
|
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 LinkGroups: React.FC<LinkGroupsProps> = ({ link }) => {
|
|
25
|
+
if (!link) return null;
|
|
26
|
+
|
|
27
|
+
// Single button
|
|
28
|
+
if (isButton(link)) {
|
|
29
|
+
const key = "submenu-link-btn";
|
|
30
|
+
return (
|
|
31
|
+
<ul>
|
|
32
|
+
<li key={key} className="submenu-link">
|
|
33
|
+
<Button {...link} linkVariant="unstyled" />
|
|
34
|
+
</li>
|
|
35
|
+
</ul>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Group
|
|
40
|
+
const { anchorId, title, items } = link;
|
|
41
|
+
const subMenu = Array.isArray(items?.items) ? items!.items! : [];
|
|
42
|
+
|
|
43
|
+
const RenderSubMenu: React.FC<{ items: ContentfulButtonProps[] }> = ({
|
|
44
|
+
items,
|
|
45
|
+
}) => (
|
|
46
|
+
<ul>
|
|
47
|
+
{items.map((site, index) => {
|
|
48
|
+
const key = `submenu-link-${index}`;
|
|
49
|
+
return (
|
|
50
|
+
<li key={key} className="submenu-link">
|
|
51
|
+
<Button {...site} linkVariant="unstyled" />
|
|
52
|
+
</li>
|
|
53
|
+
);
|
|
54
|
+
})}
|
|
55
|
+
</ul>
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div id={anchorId ?? undefined}>
|
|
60
|
+
<div>{title ?? null}</div>
|
|
61
|
+
{subMenu.length > 0 && <RenderSubMenu items={subMenu} />}
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
export type NavigationProps = {
|
|
1
|
+
export type NavigationProps = {
|
|
2
|
+
primaryNavigationLogo?: string;
|
|
3
|
+
primaryNavigationLinks?: Array<any>;
|
|
4
|
+
supportNavigationLinks?: Array<any>;
|
|
5
|
+
utilityNavigationLinks?: Array<any>;
|
|
6
|
+
accountNavigationLinks?: Array<any>;
|
|
7
|
+
searchBarIcon?: string;
|
|
8
|
+
searchBarPlaceholder?: string;
|
|
9
|
+
navigationBackgroundColor?: string;
|
|
10
|
+
utilityNavBackgroundColor?: string;
|
|
11
|
+
utilityNavLinkColor?: string;
|
|
12
|
+
callNowCtaText?: string;
|
|
13
|
+
callNowCtaIcon?: string;
|
|
14
|
+
displaySearchBar?: boolean;
|
|
15
|
+
displayCallNowCta?: boolean;
|
|
16
|
+
displayUtilityNavigation?: boolean;
|
|
17
|
+
showCallButton?: boolean;
|
|
18
|
+
showMobileSliderMenu?: boolean;
|
|
19
|
+
showCallNowCtaInMainNav?: boolean;
|
|
20
|
+
maxWidth?: boolean;
|
|
21
|
+
};
|