@qite/tide-booking-component 1.4.50 → 1.4.51

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.
@@ -28752,7 +28752,8 @@ var LanguageSwitcher = function (_a) {
28752
28752
  };
28753
28753
 
28754
28754
  var Navbar = function (_a) {
28755
- var logo = _a.logo,
28755
+ var currentPath = _a.currentPath,
28756
+ logo = _a.logo,
28756
28757
  topLinks = _a.topLinks,
28757
28758
  items = _a.items,
28758
28759
  language = _a.language,
@@ -28768,7 +28769,6 @@ var Navbar = function (_a) {
28768
28769
  var _d = React.useState(),
28769
28770
  activeMobileGroup = _d[0],
28770
28771
  setActiveMobileGroup = _d[1];
28771
- var location = reactRouter.useLocation();
28772
28772
  var normalizePath = function (path) {
28773
28773
  return path.replace(/\/+$/, '');
28774
28774
  };
@@ -28807,7 +28807,7 @@ var Navbar = function (_a) {
28807
28807
  };
28808
28808
  var isActive = function (item) {
28809
28809
  var _a;
28810
- return location && normalizePath(location.pathname) === normalizePath('/' + ((_a = item.href) !== null && _a !== void 0 ? _a : ''));
28810
+ return currentPath && normalizePath(currentPath) === normalizePath('/' + ((_a = item.href) !== null && _a !== void 0 ? _a : ''));
28811
28811
  };
28812
28812
  var renderNavItem = function (item) {
28813
28813
  var _a, _b;
@@ -16,6 +16,7 @@ export interface NavItem {
16
16
  items?: NavLink[];
17
17
  }
18
18
  export interface NavbarProps {
19
+ currentPath?: string;
19
20
  logo: React.ReactNode;
20
21
  topLinks: NavLink[];
21
22
  items: NavItem[];
@@ -28655,7 +28655,8 @@ var LanguageSwitcher = function (_a) {
28655
28655
  };
28656
28656
 
28657
28657
  var Navbar = function (_a) {
28658
- var logo = _a.logo,
28658
+ var currentPath = _a.currentPath,
28659
+ logo = _a.logo,
28659
28660
  topLinks = _a.topLinks,
28660
28661
  items = _a.items,
28661
28662
  language = _a.language,
@@ -28671,7 +28672,6 @@ var Navbar = function (_a) {
28671
28672
  var _d = useState(),
28672
28673
  activeMobileGroup = _d[0],
28673
28674
  setActiveMobileGroup = _d[1];
28674
- var location = useLocation();
28675
28675
  var normalizePath = function (path) {
28676
28676
  return path.replace(/\/+$/, '');
28677
28677
  };
@@ -28710,7 +28710,7 @@ var Navbar = function (_a) {
28710
28710
  };
28711
28711
  var isActive = function (item) {
28712
28712
  var _a;
28713
- return location && normalizePath(location.pathname) === normalizePath('/' + ((_a = item.href) !== null && _a !== void 0 ? _a : ''));
28713
+ return currentPath && normalizePath(currentPath) === normalizePath('/' + ((_a = item.href) !== null && _a !== void 0 ? _a : ''));
28714
28714
  };
28715
28715
  var renderNavItem = function (item) {
28716
28716
  var _a, _b;
@@ -16,6 +16,7 @@ export interface NavItem {
16
16
  items?: NavLink[];
17
17
  }
18
18
  export interface NavbarProps {
19
+ currentPath?: string;
19
20
  logo: React.ReactNode;
20
21
  topLinks: NavLink[];
21
22
  items: NavItem[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qite/tide-booking-component",
3
- "version": "1.4.50",
3
+ "version": "1.4.51",
4
4
  "description": "React Booking wizard & Booking product component for Tide",
5
5
  "main": "build/build-cjs/index.js",
6
6
  "types": "build/build-cjs/src/index.d.ts",
@@ -2,14 +2,12 @@ import React, { useEffect, useState } from 'react';
2
2
  import LanguageSwitcher from '../components/LanguageSwitcher';
3
3
  import Icon from '../components/icon';
4
4
  import { NavbarProps, NavItem } from '../navbar/types';
5
- import { useLocation } from 'react-router-dom';
6
5
 
7
- const Navbar: React.FC<NavbarProps> = ({ logo, topLinks, items, language, languages, onLanguageChange, onSearch }) => {
6
+ const Navbar: React.FC<NavbarProps> = ({ currentPath, logo, topLinks, items, language, languages, onLanguageChange, onSearch }) => {
8
7
  const [menuOpen, setMenuOpen] = useState(false);
9
8
  const [query, setQuery] = useState('');
10
9
  const [activeMobileGroup, setActiveMobileGroup] = useState<string>();
11
10
 
12
- const location = useLocation();
13
11
  const normalizePath = (path: string) => path.replace(/\/+$/, '');
14
12
 
15
13
  useEffect(() => {
@@ -45,7 +43,7 @@ const Navbar: React.FC<NavbarProps> = ({ logo, topLinks, items, language, langua
45
43
  };
46
44
 
47
45
  const isActive = (item: NavItem) => {
48
- return location && normalizePath(location.pathname) === normalizePath('/' + (item.href ?? ''));
46
+ return currentPath && normalizePath(currentPath) === normalizePath('/' + (item.href ?? ''));
49
47
  };
50
48
 
51
49
  const renderNavItem = (item: NavItem) => {
@@ -21,6 +21,8 @@ export interface NavItem {
21
21
  }
22
22
 
23
23
  export interface NavbarProps {
24
+ currentPath?: string;
25
+
24
26
  logo: React.ReactNode;
25
27
 
26
28
  topLinks: NavLink[];