@windstream/react-shared-components 0.2.51 → 0.2.52

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.2.51",
3
+ "version": "0.2.52",
4
4
  "type": "module",
5
5
  "description": "Shared React components for Kinetic applications",
6
6
  "main": "dist/index.js",
@@ -149,6 +149,40 @@ const mobileMenuProps: NavigationProps = {
149
149
  describe("Navigation", () => {
150
150
  beforeEach(() => jest.clearAllMocks());
151
151
 
152
+ describe("enableHamburgerNavigationOnDesktop (desktop hamburger A/B variant)", () => {
153
+ it("keeps current behavior when the flag is off", () => {
154
+ const { container } = render(<Navigation {...defaultProps} />);
155
+
156
+ expect(
157
+ container.querySelector(".mobile-nav-section")?.className
158
+ ).toContain("lg:hidden");
159
+ expect(
160
+ container.querySelector(".desktop-nav-section")?.className
161
+ ).toContain("lg:block");
162
+ expect(
163
+ container.querySelector(".utility-container")?.className
164
+ ).toContain("lg:block");
165
+ });
166
+
167
+ it("shows the hamburger and hides desktop + utility sections when enabled", () => {
168
+ const { container } = render(
169
+ <Navigation {...defaultProps} enableHamburgerNavigationOnDesktop />
170
+ );
171
+
172
+ // mobile section no longer hidden on desktop
173
+ expect(
174
+ container.querySelector(".mobile-nav-section")?.className
175
+ ).not.toContain("lg:hidden");
176
+ // desktop + utility hidden at all widths (no lg:block to re-show them)
177
+ expect(
178
+ container.querySelector(".desktop-nav-section")?.className
179
+ ).not.toContain("lg:block");
180
+ expect(
181
+ container.querySelector(".utility-container")?.className
182
+ ).not.toContain("lg:block");
183
+ });
184
+ });
185
+
152
186
  describe("Basic rendering", () => {
153
187
  it("renders nav with utility and main nav sections", () => {
154
188
  const { container } = render(<Navigation {...defaultProps} />);
@@ -42,6 +42,7 @@ export const Navigation: React.FC<NavigationProps> = props => {
42
42
  showCallButton = true,
43
43
  showCallNowCtaInMainNav = false,
44
44
  showMobileSliderMenu = true,
45
+ enableHamburgerNavigationOnDesktop = false,
45
46
  callNowCtaIcon,
46
47
  navigationBackgroundColor,
47
48
  navigationLinkColor,
@@ -106,11 +107,28 @@ export const Navigation: React.FC<NavigationProps> = props => {
106
107
  (supportNavigationLinks?.length ?? 0) > 0 ||
107
108
  (accountNavigationLinks?.length ?? 0) > 0;
108
109
 
110
+ // A/B variant: when enabled, the hamburger (mobile section) shows on desktop
111
+ // and the inline desktop nav is hidden. Off = current behavior.
112
+ const mobileNavResponsiveClass = enableHamburgerNavigationOnDesktop
113
+ ? undefined // visible at all widths, including desktop
114
+ : "lg:hidden"; // default: mobile/tablet only
115
+ const desktopNavResponsiveClass = enableHamburgerNavigationOnDesktop
116
+ ? "hidden" // hidden at all widths
117
+ : "hidden lg:block"; // default: desktop only
118
+ const utilityNavResponsiveClass = enableHamburgerNavigationOnDesktop
119
+ ? "hidden" // match mobile/tablet: hidden on desktop too
120
+ : "hidden lg:block"; // default: desktop only
121
+
109
122
  return (
110
123
  <div className="component-container">
111
124
  <nav className={`menu-container z-[1000]`}>
112
125
  {displayUtilityNavigation ? (
113
- <div className="utility-container hidden lg:block lg:border-b lg:px-2">
126
+ <div
127
+ className={cx(
128
+ "utility-container lg:border-b lg:px-2",
129
+ utilityNavResponsiveClass
130
+ )}
131
+ >
114
132
  <div className="mx-auto flex max-w-120 justify-between">
115
133
  <ul className="flex gap-5" aria-label="Utility Navigation">
116
134
  {utilityNavigationLinks?.map((links, index) => {
@@ -181,7 +199,12 @@ export const Navigation: React.FC<NavigationProps> = props => {
181
199
  )}
182
200
  aria-label="Main Navigation"
183
201
  >
184
- <div className="mobile-nav-section flex h-14 items-center justify-between border border-b px-5 py-[10px] lg:hidden">
202
+ <div
203
+ className={cx(
204
+ "mobile-nav-section flex h-14 items-center justify-between border border-b px-5 py-[10px]",
205
+ mobileNavResponsiveClass
206
+ )}
207
+ >
185
208
  <div>
186
209
  {logoUrl ? (
187
210
  <Link href="/" className="flex">
@@ -230,7 +253,12 @@ export const Navigation: React.FC<NavigationProps> = props => {
230
253
  </div>
231
254
  </div>
232
255
 
233
- <div className="desktop-nav-section hidden lg:block lg:border-b lg:px-2">
256
+ <div
257
+ className={cx(
258
+ "desktop-nav-section lg:border-b lg:px-2",
259
+ desktopNavResponsiveClass
260
+ )}
261
+ >
234
262
  <div className="mx-auto flex h-14 max-w-120 items-center justify-between">
235
263
  <div className="flex h-full">
236
264
  {logoUrl ? (
@@ -553,7 +581,8 @@ const DesktopSearchInput = (props: {
553
581
  height={32}
554
582
  alt="Search icon"
555
583
  role="button"
556
- onClick={redirectToSearchResults} />
584
+ onClick={redirectToSearchResults}
585
+ />
557
586
  {/* Input */}
558
587
  <Input
559
588
  ref={searchInputRef}
@@ -66,6 +66,9 @@ export interface Navigation {
66
66
  * (the one next to the cart icon and hamburger). The drawer
67
67
  * still renders the CallButton. Defaults to false. */
68
68
  hideMobileCallButton?: boolean;
69
+ /** When true, renders the mobile hamburger navigation in the desktop
70
+ * viewport and hides the inline desktop nav. Defaults to false. */
71
+ enableHamburgerNavigationOnDesktop?: boolean;
69
72
  }
70
73
 
71
74
  export type NavigationProps = Navigation;