l-min-components 1.0.415 → 1.0.422

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.415",
3
+ "version": "1.0.422",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -29,6 +29,7 @@
29
29
  "react-color": "^2.19.3",
30
30
  "react-cookie": "^4.1.1",
31
31
  "react-datepicker": "^4.10.0",
32
+ "react-debounce-input": "^3.3.0",
32
33
  "react-dom": "^18.2.0",
33
34
  "react-flags-select": "^2.2.3",
34
35
  "react-icons": "^4.8.0",
@@ -22,3 +22,18 @@ export const SearchIcon = ({ width, height, fill }) => (
22
22
  />
23
23
  </svg>
24
24
  );
25
+
26
+
27
+ export const InputSearchIcon = ({ width, height, fill }) => (
28
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
29
+ <g clip-path="url(#clip0_15174_273132)">
30
+ <path d="M8.33333 14.1667C11.555 14.1667 14.1667 11.555 14.1667 8.33333C14.1667 5.11167 11.555 2.5 8.33333 2.5C5.11167 2.5 2.5 5.11167 2.5 8.33333C2.5 11.555 5.11167 14.1667 8.33333 14.1667Z" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
31
+ <path d="M17.5 17.5L12.5 12.5" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
32
+ </g>
33
+ <defs>
34
+ <clipPath id="clip0_15174_273132">
35
+ <rect width="20" height="20" fill="white"/>
36
+ </clipPath>
37
+ </defs>
38
+ </svg>
39
+ );
@@ -23,6 +23,7 @@ import useHeader from "./getHeaderDetails";
23
23
  import { OutletContext } from "..";
24
24
  import { useLocation } from "react-router-dom";
25
25
  import usFlag from "../../assets/images/usFlag.png";
26
+ import LanguageDropdown from "./languageDropdown";
26
27
  /**
27
28
  * @param {{
28
29
  * type: string,
@@ -297,11 +298,10 @@ const HeaderComponent = (props) => {
297
298
  <ArrowDownIcon />
298
299
  </div>
299
300
  {languageDropdown && (
300
- <ul className="dropdown_list" ref={containerRef}>
301
- <li onClick={() => setLanguageDropdown()}>
302
- <img src={usFlag} alt="" /> <span>English</span>
303
- </li>
304
- </ul>
301
+ <LanguageDropdown
302
+ languageDropdown={languageDropdown}
303
+ setLanguageDropdown={setLanguageDropdown}
304
+ />
305
305
  )}
306
306
  </div>
307
307
 
@@ -51,7 +51,7 @@ export const NavGroup = styled.div`
51
51
  box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;
52
52
  left: 50%;
53
53
  transform: translateX(-50%);
54
-
54
+
55
55
  li {
56
56
  list-style-type: none;
57
57
  display: flex;
@@ -642,3 +642,85 @@ export const CountryFlagGroup2 = styled.div`
642
642
  }
643
643
  }
644
644
  `;
645
+
646
+ export const LanguageDropdownContainer = styled.div`
647
+ width: 392px;
648
+ background-color: rgba(255, 255, 255, 1);
649
+ padding: 20px 20px 0;
650
+ font-family: "Nunito";
651
+ position: absolute;
652
+ z-index: 555;
653
+ right: 0;
654
+ min-height: 350px;
655
+ border-radius: 12px;
656
+ border: 1px solid #00c2c2;
657
+ background: #fff;
658
+ top: 65px;
659
+
660
+ .ldc_header {
661
+ display: flex;
662
+ justify-content: space-between;
663
+ border-bottom: 1px solid#D9D9D9;
664
+ padding: 0 0 8px;
665
+
666
+ .ldc_title {
667
+ color: #adb2b2;
668
+ font-size: 16px;
669
+ font-weight: 400;
670
+ line-height: normal;
671
+ letter-spacing: 0.32px;
672
+ }
673
+
674
+ span {
675
+ display: flex;
676
+ align-items: center;
677
+ }
678
+ }
679
+
680
+ .ldc_search {
681
+ padding: 10px 0;
682
+ margin: 8px 0;
683
+ display: flex;
684
+ align-items: center;
685
+ padding: 8px;
686
+ border-radius: 12px;
687
+ background: #f6f6f6;
688
+ height: 34px;
689
+
690
+ span {
691
+ display: flex;
692
+ }
693
+
694
+ .search_input {
695
+ border: none;
696
+ background-color: transparent;
697
+ outline: none;
698
+ margin-left: 8px;
699
+ width: 100%;
700
+ color: #adb2b2;
701
+ font-size: 14px;
702
+ font-weight: 400;
703
+ letter-spacing: 0.28px;
704
+ }
705
+ }
706
+
707
+ .language_dropdown_list {
708
+ max-height: 200px;
709
+ overflow-y: scroll;
710
+ padding-bottom: 10px;
711
+
712
+ .language_dropdown_item {
713
+ color: #313333;
714
+ font-size: 16px;
715
+ font-weight: 400;
716
+ line-height: normal;
717
+ letter-spacing: 0.32px;
718
+ margin: 16px 0;
719
+ display: flex;
720
+ align-items: center;
721
+ span {
722
+ margin-left: 8px;
723
+ }
724
+ }
725
+ }
726
+ `;
@@ -4,22 +4,44 @@ import useHeader from "./getHeaderDetails";
4
4
  import { OutletContext } from "..";
5
5
  import { useLocation } from "react-router-dom";
6
6
  import usFlag from "../../assets/images/usFlag.png";
7
+ import { LanguageDropdownContainer } from "./index.styled";
8
+ import { RiCloseCircleFill } from "react-icons/ri";
9
+ import { HiSearch } from "react-icons/hi";
10
+ import { InputSearchIcon } from "./assets/svg/search";
11
+ import { DebounceInput } from "react-debounce-input";
12
+
7
13
  /**
8
14
  * @param {{
9
15
  * type: string,
10
16
  * text: string,
11
17
  * onClick: Function,
12
18
  * style: CSSProperties,
13
- * }} props - properties of Header Component
19
+ * }} props - properties of Language dropdown Component
14
20
  *
15
21
  */
16
- const LanguageDropdown = (props) => {
17
- const [languageDropdown, setLanguageDropdown] = useState();
18
- const { pathname } = useLocation();
22
+ const LanguageDropdown = ({ languageDropdown, setLanguageDropdown }) => {
19
23
  const { setGeneralData, generalData } = useContext(OutletContext);
20
-
24
+ const [filteredData, setFilteredData] = useState([]);
25
+ const [isSearch, setIsSearch] = useState(false);
21
26
  const containerRef = useRef(null);
22
27
 
28
+ const sampleSuggestions = ["English", "Spanish"];
29
+
30
+ const handleFilter = (event) => {
31
+ const searchWord = event.target.value;
32
+ const newFilter = sampleSuggestions.filter((item) => {
33
+ return item?.toLowerCase().includes(searchWord.toLowerCase());
34
+ });
35
+ console.log("newFilter", newFilter);
36
+ if (searchWord === "") {
37
+ setFilteredData([]);
38
+ setIsSearch(false);
39
+ } else {
40
+ setFilteredData(newFilter);
41
+ setIsSearch(true);
42
+ }
43
+ };
44
+
23
45
  // logic for closing language dropdown when clicking outside
24
46
  useEffect(() => {
25
47
  const handleClickOutside = (event) => {
@@ -39,13 +61,60 @@ const LanguageDropdown = (props) => {
39
61
  }, [setLanguageDropdown]);
40
62
 
41
63
  return (
42
- <>
43
- <ul className="dropdown_list" ref={containerRef}>
44
- <li onClick={() => setLanguageDropdown()}>
45
- <img src={usFlag} alt="" /> <span>English</span>
46
- </li>
47
- </ul>
48
- </>
64
+ <LanguageDropdownContainer ref={containerRef}>
65
+ <div className="ldc_header">
66
+ <p className="ldc_title"> Whats your language</p>
67
+ <span onClick={() => setLanguageDropdown(false)}>
68
+ <RiCloseCircleFill />
69
+ </span>
70
+ </div>
71
+
72
+ <div className="ldc_search">
73
+ <span>
74
+ <InputSearchIcon />
75
+ </span>
76
+
77
+ <DebounceInput
78
+ type="text"
79
+ debounceTimeout={500}
80
+ onChange={handleFilter}
81
+ className="search_input"
82
+ name=""
83
+ id=""
84
+ placeholder="Search"
85
+ />
86
+ </div>
87
+
88
+ <div className="language_dropdown_list">
89
+ {isSearch &&
90
+ filteredData.length > 0 &&
91
+ filteredData?.map((item, index) => (
92
+ <p
93
+ className="language_dropdown_item"
94
+ onClick={() => setLanguageDropdown()}
95
+ >
96
+ <img src={usFlag} alt="" /> <span>{item}</span>
97
+ </p>
98
+ ))}
99
+
100
+ {!isSearch && (
101
+ <>
102
+ <p
103
+ className="language_dropdown_item"
104
+ onClick={() => setLanguageDropdown()}
105
+ >
106
+ <img src={usFlag} alt="" /> <span>English</span>
107
+ </p>
108
+ <p
109
+ className="language_dropdown_item"
110
+ onClick={() => setLanguageDropdown()}
111
+ >
112
+ <img src={usFlag} alt="" /> <span>English</span>
113
+ </p>
114
+ </>
115
+ )}
116
+ </div>
117
+ </LanguageDropdownContainer>
49
118
  );
50
119
  };
51
120
 
@@ -1,5 +1,5 @@
1
- import { useState, useRef } from "react";
2
1
  import React from "react";
2
+ import { useState, useRef } from "react";
3
3
  import screenfull from "screenfull";
4
4
  import {
5
5
  RangeContainer,