@thairath/tr-design-system 0.2.17 → 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, {
@@ -6562,7 +6561,6 @@ var TROEN_SlidebarNavOther = /*#__PURE__*/_styled("div", process.env.NODE_ENV ==
6562
6561
  });
6563
6562
 
6564
6563
  // src/components/organisms/HeaderEN/headerEN.client.tsx
6565
-
6566
6564
  function TROENHeaderClient(_ref) {
6567
6565
  var {
6568
6566
  data,
@@ -6573,7 +6571,7 @@ function TROENHeaderClient(_ref) {
6573
6571
  var [isMobileView, setIsMobileView] = useState(false);
6574
6572
  var [showStickyLogo, setShowStickyLogo] = useState(false);
6575
6573
  var containerRef = useRef(null);
6576
- var pathname = usePathname();
6574
+ var [pathname, setPathname] = useState(window.location.pathname);
6577
6575
  // Detect mobile viewport
6578
6576
  useEffect(() => {
6579
6577
  var m = window.matchMedia("(max-width: 1023px)");
@@ -6589,6 +6587,11 @@ function TROENHeaderClient(_ref) {
6589
6587
  window.addEventListener("scroll", onScroll);
6590
6588
  return () => window.removeEventListener("scroll", onScroll);
6591
6589
  }, [isMobileView]);
6590
+ useEffect(() => {
6591
+ var handlePathChange = () => setPathname(window.location.pathname);
6592
+ window.addEventListener("popstate", handlePathChange);
6593
+ return () => window.removeEventListener("popstate", handlePathChange);
6594
+ }, []);
6592
6595
  // Scroll active menu into center
6593
6596
  useEffect(() => {
6594
6597
  var _a;
@@ -6730,7 +6733,7 @@ function TROENHeaderClient(_ref) {
6730
6733
  }, item.name))))))));
6731
6734
  }
6732
6735
 
6733
- var menu = {
6736
+ var data = {
6734
6737
  naviMenu: [{
6735
6738
  category: "Home",
6736
6739
  link: "/"
@@ -6833,14 +6836,14 @@ var menu = {
6833
6836
  }]
6834
6837
  };
6835
6838
 
6836
- // src/components/organisms/HeaderEN/headerEN.server.tsx
6839
+ // src/components/organisms/HeaderEN/headerEN.tsx
6837
6840
  var TROENHeader = _ref => {
6838
6841
  var {
6839
6842
  logoColor = 'Color',
6840
6843
  loading = "Loading..."
6841
6844
  } = _ref;
6842
6845
  return /*#__PURE__*/React.createElement(TROENHeaderClient, {
6843
- data: menu,
6846
+ data: data,
6844
6847
  logoColor: logoColor,
6845
6848
  loading: loading
6846
6849
  });