@thairath/tr-design-system 0.2.18 → 0.2.19

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/index.esm.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import React$1, { useState, useEffect, useRef, useContext, createContext } from 'react';
2
2
  import _styled from '@emotion/styled/base';
3
- import { usePathname } from 'next/navigation';
4
3
 
5
4
  function _defineProperty(e, r, t) {
6
5
  return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
@@ -6572,7 +6571,7 @@ function TROENHeaderClient(_ref) {
6572
6571
  var [isMobileView, setIsMobileView] = useState(false);
6573
6572
  var [showStickyLogo, setShowStickyLogo] = useState(false);
6574
6573
  var containerRef = useRef(null);
6575
- var pathname = usePathname();
6574
+ var [pathname, setPathname] = useState(window.location.pathname);
6576
6575
  // Detect mobile viewport
6577
6576
  useEffect(() => {
6578
6577
  var m = window.matchMedia("(max-width: 1023px)");
@@ -6588,6 +6587,11 @@ function TROENHeaderClient(_ref) {
6588
6587
  window.addEventListener("scroll", onScroll);
6589
6588
  return () => window.removeEventListener("scroll", onScroll);
6590
6589
  }, [isMobileView]);
6590
+ useEffect(() => {
6591
+ var handlePathChange = () => setPathname(window.location.pathname);
6592
+ window.addEventListener("popstate", handlePathChange);
6593
+ return () => window.removeEventListener("popstate", handlePathChange);
6594
+ }, []);
6591
6595
  // Scroll active menu into center
6592
6596
  useEffect(() => {
6593
6597
  var _a;
@@ -6729,7 +6733,7 @@ function TROENHeaderClient(_ref) {
6729
6733
  }, item.name))))))));
6730
6734
  }
6731
6735
 
6732
- var menu = {
6736
+ var data = {
6733
6737
  naviMenu: [{
6734
6738
  category: "Home",
6735
6739
  link: "/"
@@ -6832,14 +6836,14 @@ var menu = {
6832
6836
  }]
6833
6837
  };
6834
6838
 
6835
- // src/components/organisms/HeaderEN/headerEN.server.tsx
6839
+ // src/components/organisms/HeaderEN/headerEN.tsx
6836
6840
  var TROENHeader = _ref => {
6837
6841
  var {
6838
6842
  logoColor = 'Color',
6839
6843
  loading = "Loading..."
6840
6844
  } = _ref;
6841
6845
  return /*#__PURE__*/React.createElement(TROENHeaderClient, {
6842
- data: menu,
6846
+ data: data,
6843
6847
  logoColor: logoColor,
6844
6848
  loading: loading
6845
6849
  });