l-min-components 1.0.753 → 1.0.761

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": "l-min-components",
3
- "version": "1.0.753",
3
+ "version": "1.0.761",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -363,7 +363,9 @@ const HeaderComponent = (props) => {
363
363
  handleGetUnreadNotification();
364
364
  handleGeneralNotificationCount();
365
365
  }, [notificationMarkReadData?.response]);
366
-
366
+ const value = JSON?.parse(localStorage.getItem("defaultLang"));
367
+ const currentFlag = value?.flag;
368
+
367
369
  return (
368
370
  <Navbar>
369
371
  <img src={logo} alt="Learngual logo" />
@@ -455,7 +457,7 @@ const HeaderComponent = (props) => {
455
457
  setLanguageDropdown(!languageDropdown);
456
458
  setIsOpen();
457
459
  }}>
458
- <img src={usFlag} alt="" />
460
+ <img src={currentFlag || usFlag} alt="" />
459
461
  <ArrowDownIcon />
460
462
  </div>
461
463
  {languageDropdown && (
@@ -21,13 +21,25 @@ import { DebounceInput } from "react-debounce-input";
21
21
  *
22
22
  */
23
23
  const LanguageDropdown = ({ languageDropdown, setLanguageDropdown }) => {
24
- const { setGeneralData, generalData, setDefaultLang, findText } =
24
+ const { setGeneralData, generalData, defaultLang, setDefaultLang, findText } =
25
25
  useContext(OutletContext);
26
+ const languagesData = [
27
+ {
28
+ name: "English",
29
+ flag: usFlag,
30
+ slug: "en",
31
+ },
32
+ {
33
+ name: "Korean",
34
+ flag: koreanFlag,
35
+ slug: "ko",
36
+ },
37
+ ];
26
38
  const [filteredData, setFilteredData] = useState([]);
27
39
  const [isSearch, setIsSearch] = useState(false);
28
40
  const containerRef = useRef(null);
29
-
30
- const sampleSuggestions = ["English", "Spanish"];
41
+ const value = JSON?.parse(localStorage.getItem("defaultLang"));
42
+ const currentFlag = value?.flag;
31
43
 
32
44
  const handleFilter = (event) => {
33
45
  const searchWord = event.target.value;
@@ -62,19 +74,6 @@ const LanguageDropdown = ({ languageDropdown, setLanguageDropdown }) => {
62
74
  };
63
75
  }, [setLanguageDropdown]);
64
76
 
65
- const languagesData = [
66
- {
67
- name: "English",
68
- flag: usFlag,
69
- slug: "en",
70
- },
71
- {
72
- name: "Korean",
73
- flag: koreanFlag,
74
- slug: "ko",
75
- },
76
- ];
77
-
78
77
  return (
79
78
  <LanguageDropdownContainer ref={containerRef}>
80
79
  <div className="ldc_header">
@@ -109,7 +108,7 @@ const LanguageDropdown = ({ languageDropdown, setLanguageDropdown }) => {
109
108
  onClick={() => {
110
109
  setLanguageDropdown();
111
110
  setDefaultLang(item?.slug);
112
- localStorage.setItem("defaultLang", item?.slug);
111
+ localStorage.setItem("defaultLang", JSON.stringify(item));
113
112
  }}
114
113
  >
115
114
  <img src={item?.flag} alt="" /> <span>{item?.name}</span>
@@ -124,7 +123,7 @@ const LanguageDropdown = ({ languageDropdown, setLanguageDropdown }) => {
124
123
  onClick={() => {
125
124
  setLanguageDropdown();
126
125
  setDefaultLang(item?.slug);
127
- localStorage.setItem("defaultLang", item?.slug);
126
+ localStorage.setItem("defaultLang", JSON.stringify(item));
128
127
  }}
129
128
  >
130
129
  <img src={item?.flag} alt="" />{" "}
@@ -6,6 +6,7 @@ import { ArrowDownIcon } from "./assets/svg/arrow-down";
6
6
  import ButtonComponent from "../button";
7
7
  import { useLocation, useNavigate } from "react-router-dom";
8
8
  import usFlag from "../../assets/images/usFlag.png";
9
+ import koreanFlag from "../../assets/images/koreaFlag.png";
9
10
  import { OutletContext } from "..";
10
11
 
11
12
  /**
@@ -24,6 +25,8 @@ const HeaderComponentTwo = (props) => {
24
25
  const [isOpen, setIsOpen] = useState(false);
25
26
  const [searchResultOpen, setSearchResultOpen] = useState(false);
26
27
  const [languageDropdown, setLanguageDropdown] = useState();
28
+ const value = JSON?.parse(localStorage.getItem("defaultLang"));
29
+ const currentFlag = value?.flag;
27
30
 
28
31
  const navigate = useNavigate();
29
32
  const location = useLocation();
@@ -103,7 +106,7 @@ const HeaderComponentTwo = (props) => {
103
106
  className="drop_holder"
104
107
  onClick={() => setLanguageDropdown(!languageDropdown)}
105
108
  >
106
- <img src={usFlag} alt="" />
109
+ <img src={currentFlag || usFlag} alt="" />
107
110
  <ArrowDownIcon />
108
111
  </div>
109
112
  {languageDropdown && (
@@ -113,7 +116,7 @@ const HeaderComponentTwo = (props) => {
113
116
  onClick={() => {
114
117
  setLanguageDropdown();
115
118
  setDefaultLang(item?.slug);
116
- localStorage.setItem("defaultLang", item?.slug);
119
+ localStorage.setItem("defaultLang", JSON.stringify(item));
117
120
  }}
118
121
  >
119
122
  <img src={item?.flag} alt="" /> <span>{item?.name}</span>
@@ -1,4 +1,4 @@
1
- import { useCallback, useEffect, useState } from "react";
1
+ import React, { useCallback, useEffect, useState } from "react";
2
2
  import loadTranslations from "./utils/translation";
3
3
 
4
4
  const useTranslation = () => {