@windstream/react-shared-components 0.0.72 → 0.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windstream/react-shared-components",
3
- "version": "0.0.72",
3
+ "version": "0.0.73",
4
4
  "type": "module",
5
5
  "description": "Shared React components for Kinetic applications",
6
6
  "main": "dist/index.js",
@@ -2,6 +2,7 @@ import type { CallButtonProps } from "@shared/components/call-button/types";
2
2
  import { Link } from "@shared/components/link";
3
3
  import { MaterialIcon } from "@shared/components/material-icon";
4
4
  import type { IconProps } from "@shared/components/material-icon/types";
5
+ import { cx } from "@shared/utils";
5
6
 
6
7
  export const CallButton = (props: CallButtonProps) => {
7
8
  const {
@@ -9,6 +10,7 @@ export const CallButton = (props: CallButtonProps) => {
9
10
  buttonStyle = "primary",
10
11
  size = "md",
11
12
  children,
13
+ className,
12
14
  ...rest
13
15
  } = props;
14
16
 
@@ -52,7 +54,12 @@ export const CallButton = (props: CallButtonProps) => {
52
54
  return (
53
55
  <Link
54
56
  {...rest}
55
- className={`${baseClasses} ${sizeClasses[size]} ${styleClasses[buttonStyle]}`}
57
+ className={cx(
58
+ baseClasses,
59
+ sizeClasses[size],
60
+ styleClasses[buttonStyle],
61
+ className
62
+ )}
56
63
  >
57
64
  {showBlinkDot ? (
58
65
  <span
@@ -5,6 +5,7 @@ import { LinkProps } from "@shared/components/link/types";
5
5
  export interface CallButtonProps extends Omit<LinkProps, "children"> {
6
6
  showBlinkDot?: boolean;
7
7
  buttonStyle?: "primary";
8
+ className?: string;
8
9
  size?: "sm" | "md" | "lg";
9
10
  children: ReactNode;
10
11
  }
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import { ButtonProps } from "./types";
3
3
 
4
4
  import { BrandButton } from "@shared/components/brand-button";
5
+ import { Button as CoreButton } from "@shared/components/button";
5
6
  import { Link } from "@shared/components/link";
6
7
 
7
8
  export const Button: React.FC<ButtonProps> = ({
@@ -17,7 +18,9 @@ export const Button: React.FC<ButtonProps> = ({
17
18
  fullWidth,
18
19
  preDefinedFunctionExecution,
19
20
  checkPlansJSX,
21
+ buttonClassName,
20
22
  onClick,
23
+ ...rest
21
24
  }) => {
22
25
  if (preDefinedFunctionExecution === "check availability") {
23
26
  return checkPlansJSX;
@@ -30,35 +33,52 @@ export const Button: React.FC<ButtonProps> = ({
30
33
  onClick?.(event);
31
34
  }
32
35
 
33
- return showButtonAs === "solid" ? (
34
- <BrandButton
35
- id={anchorId}
36
- variant={buttonVariant}
37
- text={buttonLabel}
38
- label={buttonPrefix}
39
- fullWidth={fullWidth}
40
- onClick={buttonClick}
41
- // badge={badge}
42
- // badgeIcon={badgeIcon}
43
- // icon={buttonIcon}
44
- // iconPosition={buttonIconPosition}
45
- // href={href}
46
- // target={target}
47
- // preserveQueryParameters={preserveQueryParameters}
48
- // clickToOpen={clickToOpen}
49
- // tabmodalNameToOpen={tabmodalNameToOpen}
50
- // preDefinedFunctionExecution={preDefinedFunctionExecution}
51
- />
52
- ) : showButtonAs === "text" ? (
53
- <Link
54
- href={href}
55
- target={target}
56
- variant={linkVariant || "default"}
57
- className={`text-text-brand ${linkClassName || ""}`}
58
- onClick={linkClick}
59
- >
60
- {buttonLabel}
61
- </Link>
62
- ) : null;
36
+ let CTA = (
37
+ <CoreButton onClick={buttonClick} className={buttonClassName} {...rest} />
38
+ );
39
+
40
+ switch (showButtonAs) {
41
+ case "solid":
42
+ CTA = (
43
+ <BrandButton
44
+ id={anchorId}
45
+ variant={buttonVariant}
46
+ text={buttonLabel}
47
+ label={buttonPrefix}
48
+ fullWidth={fullWidth}
49
+ onClick={buttonClick}
50
+ // badge={badge}
51
+ // badgeIcon={badgeIcon}
52
+ // icon={buttonIcon}
53
+ // iconPosition={buttonIconPosition}
54
+ // href={href}
55
+ // target={target}
56
+ // preserveQueryParameters={preserveQueryParameters}
57
+ // clickToOpen={clickToOpen}
58
+ // tabmodalNameToOpen={tabmodalNameToOpen}
59
+ // preDefinedFunctionExecution={preDefinedFunctionExecution}
60
+ />
61
+ );
62
+ break;
63
+ case "text":
64
+ CTA = (
65
+ <Link
66
+ href={href}
67
+ target={target}
68
+ variant={linkVariant || "default"}
69
+ className={`text-text-brand ${linkClassName || ""}`}
70
+ onClick={linkClick}
71
+ >
72
+ {buttonLabel}
73
+ </Link>
74
+ );
75
+ break;
76
+ case "unstyled": // For unstyled, we can use the CoreButton without any additional styling
77
+ break;
78
+ default: // For default, we can use the CoreButton without any additional styling
79
+ break;
80
+ }
81
+
82
+ return CTA;
63
83
  };
64
84
  export default Button;
@@ -1,5 +1,5 @@
1
1
  export type ButtonProps = {
2
- showButtonAs?: "solid" | "text";
2
+ showButtonAs?: "solid" | "text" | "unstyled";
3
3
  buttonVariant?: "primary_brand" | "secondary" | "primary_inverse";
4
4
  buttonLabel?: string;
5
5
  buttonPrefix?: string;
@@ -16,9 +16,11 @@ export type ButtonProps = {
16
16
  preDefinedFunctionExecution?: string;
17
17
  checkPlansJSX?: React.ReactNode;
18
18
  linkClassName?: string;
19
+ buttonClassName?: string;
19
20
  linkVariant?: "unstyled" | "default";
20
21
  fullWidth?: boolean;
21
22
  onClick?: (
22
23
  event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>
23
24
  ) => void;
25
+ children?: React.ReactNode;
24
26
  };
@@ -1,6 +1,5 @@
1
1
  import React, { CSSProperties } from "react";
2
2
 
3
- import { Button as CoreButton } from "@shared/components/button";
4
3
  import { MaterialIcon } from "@shared/components/material-icon";
5
4
  import { Text } from "@shared/components/text";
6
5
  import { Button } from "@shared/contentful/blocks/button";
@@ -60,11 +59,12 @@ export const DesktopLinkGroups: React.FC<LinkGroupsProps> = ({
60
59
  style={{ anchorName: fullAnchorName } as CSSProperties}
61
60
  ref={ref}
62
61
  >
63
- <CoreButton
62
+ <Button
64
63
  onClick={() => setIsOpen(prev => !prev)}
65
64
  aria-expanded={isOpen}
66
- className="group body3 flex h-full items-center"
65
+ buttonClassName="group body3 flex h-full items-center"
67
66
  key={anchorId}
67
+ showButtonAs="unstyled"
68
68
  >
69
69
  <Text as="span" className="group-hover:underline">
70
70
  {title ?? null}
@@ -74,7 +74,7 @@ export const DesktopLinkGroups: React.FC<LinkGroupsProps> = ({
74
74
  className="text-icon-info group-hover:opacity-50"
75
75
  name={isOpen ? "keyboard_arrow_up" : "keyboard_arrow_down"}
76
76
  />
77
- </CoreButton>
77
+ </Button>
78
78
 
79
79
  <div
80
80
  className={cx(
@@ -3,7 +3,6 @@ import { DesktopLinkGroups } from "./desktop-link-groups.tsx";
3
3
  import { MobileLinkGroups } from "./mobile-link-groups.tsx";
4
4
  import { NavigationProps } from "./types";
5
5
 
6
- import { Button } from "@shared/components/button";
7
6
  import { CallButton } from "@shared/components/call-button";
8
7
  import { Input } from "@shared/components/input";
9
8
  import { MaterialIcon } from "@shared/components/material-icon";
@@ -21,6 +20,8 @@ export const Navigation: React.FC<NavigationProps> = props => {
21
20
  accountNavigationLinks,
22
21
  supportNavigationLinks,
23
22
  searchBarIcon,
23
+ invocaPhoneNumberLink,
24
+ invocaPhoneNumberDisplayText,
24
25
  onSearch = () => {},
25
26
  } = props;
26
27
  return (
@@ -47,8 +48,8 @@ export const Navigation: React.FC<NavigationProps> = props => {
47
48
  })}
48
49
  </ul>
49
50
  <div className="flex items-center gap-10">
50
- <CallButton href="tel:1234567890">
51
- <Text className="body3">(123) 456-7890</Text>
51
+ <CallButton className="border-none" href={invocaPhoneNumberLink}>
52
+ <Text className="body3">{invocaPhoneNumberDisplayText}</Text>
52
53
  </CallButton>
53
54
  {accountNavigationLinks?.map((links, index) => {
54
55
  return (
@@ -77,9 +78,9 @@ export const Navigation: React.FC<NavigationProps> = props => {
77
78
  />
78
79
  </div>
79
80
  <div className="flex items-center gap-6">
80
- <CallButton href="tel:1234567890">
81
+ <CallButton href={invocaPhoneNumberLink}>
81
82
  <Text as="span" className="footnote">
82
- (123) 456-7890
83
+ {invocaPhoneNumberDisplayText}
83
84
  </Text>
84
85
  </CallButton>
85
86
  <MobileMenu {...props} />
@@ -196,9 +197,13 @@ const MobileMenu = (props: NavigationProps) => {
196
197
 
197
198
  return (
198
199
  <div>
199
- <Button className="flex" onClick={() => setIsOpen(true)}>
200
+ <ContentfulButton
201
+ showButtonAs="unstyled"
202
+ buttonClassName="flex"
203
+ onClick={() => setIsOpen(true)}
204
+ >
200
205
  <MaterialIcon name="menu" />
201
- </Button>
206
+ </ContentfulButton>
202
207
  {isOpen ? (
203
208
  <div className="fixed bottom-0 left-0 right-0 top-0 z-[90] h-full w-full bg-scrim-bg-modal"></div>
204
209
  ) : null}
@@ -216,12 +221,21 @@ const MobileMenu = (props: NavigationProps) => {
216
221
  <div id="drawer-items" className="flex h-full flex-col gap-3">
217
222
  <div className="flex items-center justify-between px-4">
218
223
  <div>
219
- <CallButton href="tel:1234567890">(123) 456-7890</CallButton>
224
+ <CallButton
225
+ className="border-none"
226
+ href={props.invocaPhoneNumberLink}
227
+ >
228
+ {props.invocaPhoneNumberDisplayText}
229
+ </CallButton>
220
230
  </div>
221
231
  <div>
222
- <Button onClick={closeMenu} className="focus-item flex">
232
+ <ContentfulButton
233
+ showButtonAs="unstyled"
234
+ buttonClassName="focus-item flex"
235
+ onClick={closeMenu}
236
+ >
223
237
  <MaterialIcon name="close" />
224
- </Button>
238
+ </ContentfulButton>
225
239
  </div>
226
240
  </div>
227
241
  <MobileSearchInput
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
2
 
3
- import { Button as CoreButton } from "@shared/components/button";
4
3
  import { MaterialIcon } from "@shared/components/material-icon";
5
4
  import { Button } from "@shared/contentful/blocks/button";
6
5
  import { ButtonProps as ContentfulButtonProps } from "@shared/contentful/blocks/button/types";
@@ -44,18 +43,19 @@ export const MobileLinkGroups: React.FC<LinkGroupsProps> = ({ link }) => {
44
43
 
45
44
  return (
46
45
  <>
47
- <CoreButton
46
+ <Button
48
47
  onClick={() => setIsOpen(prev => !prev)}
49
48
  aria-expanded={isOpen}
50
- className="label3 flex h-11 w-full items-center px-4"
49
+ buttonClassName="label3 flex h-11 w-full items-center px-4"
51
50
  key={anchorId}
51
+ showButtonAs="unstyled"
52
52
  >
53
53
  {title ?? null}
54
54
  <MaterialIcon
55
55
  weight="700"
56
56
  name={isOpen ? "keyboard_arrow_up" : "keyboard_arrow_down"}
57
57
  />
58
- </CoreButton>
58
+ </Button>
59
59
  {isOpen && subMenu.length > 0 && <RenderSubMenu items={subMenu} />}
60
60
  </>
61
61
  );
@@ -32,6 +32,8 @@ export interface Navigation {
32
32
  showCallButton?: boolean;
33
33
  showMobileSliderMenu?: boolean;
34
34
  showCallNowCtaInMainNav?: boolean;
35
+ invocaPhoneNumberLink?: string;
36
+ invocaPhoneNumberDisplayText?: string;
35
37
  checkPlansJSX?: React.ReactNode;
36
38
  onSearch?: (query: string) => void;
37
39
  }
@@ -37,7 +37,7 @@ export const PrimaryHero: React.FC<PrimaryHeroProps> = props => {
37
37
  {title && (
38
38
  <Text
39
39
  as={showAsHeading ? "h1" : "h2"}
40
- className="heading2 font-bold lg:heading1"
40
+ className="heading2 lg:heading1"
41
41
  >
42
42
  {title}
43
43
  </Text>