l-min-components 1.0.357 → 1.0.366

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.357",
3
+ "version": "1.0.366",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
Binary file
@@ -0,0 +1,16 @@
1
+ const ArrowDown = ({ width, height, fill }) => (
2
+ <svg
3
+ width={width || "30"}
4
+ height={height || "30"}
5
+ viewBox="0 0 30 30"
6
+ fill="none"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ >
9
+ <path
10
+ d="M25.6094 10.5813L15.0031 21.1875L4.39688 10.5813L6.16438 8.8125L15.0031 17.6525L23.8419 8.8125L25.6094 10.5813Z"
11
+ fill={fill || "#F5F7F7"}
12
+ />
13
+ </svg>
14
+ );
15
+
16
+ export default ArrowDown;
@@ -0,0 +1,28 @@
1
+ const CloseIcon = ({ onClick }) => {
2
+ return (
3
+ <svg
4
+ width="35"
5
+ height="34"
6
+ viewBox="0 0 35 34"
7
+ fill="none"
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ onClick={onClick}
10
+ >
11
+ <path
12
+ d="M13.0547 12.7266L21.54 21.2118"
13
+ stroke="#0C0D0D"
14
+ strokeWidth="1.5"
15
+ strokeLinecap="round"
16
+ strokeLinejoin="round"
17
+ />
18
+ <path
19
+ d="M13.0538 21.2118L21.5391 12.7266"
20
+ stroke="#0C0D0D"
21
+ strokeWidth="1.5"
22
+ strokeLinecap="round"
23
+ strokeLinejoin="round"
24
+ />
25
+ </svg>
26
+ );
27
+ };
28
+ export default CloseIcon;
@@ -0,0 +1,26 @@
1
+ const InstructorIcon = () => {
2
+ return (
3
+ <svg
4
+ width="30"
5
+ height="23"
6
+ viewBox="0 0 30 23"
7
+ fill="none"
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ >
10
+ <path
11
+ fillRule="evenodd"
12
+ clipRule="evenodd"
13
+ d="M7.4688 8.20365C7.4688 8.35583 7.31077 8.43192 7.21127 8.54313C7.16444 8.58995 7.17615 8.57239 7.14103 8.63093C7.08835 8.71872 6.98885 8.85919 6.98885 8.96455C6.98885 9.07576 7.04153 9.09332 7.10006 9.21038C7.17615 9.36841 7.13518 9.32744 7.25809 9.45035L9.83344 12.0784C9.83929 12.0842 9.851 12.0901 9.85685 12.0959L11.3552 13.6353C11.3786 13.6646 11.4196 13.6997 11.4547 13.7348L12.6722 14.9581C12.678 14.9639 12.6839 14.9698 12.6897 14.9756L13.0995 15.2507C13.1697 15.2976 13.1229 15.321 13.2282 15.321C14.0301 15.321 14.0476 15.4146 14.7207 14.8527L15.1831 14.4372C15.189 14.4313 15.1948 14.4196 15.2007 14.4138L16.1138 13.5241C16.7927 12.851 16.6288 13.0851 16.6288 14.5601C16.6288 15.9473 16.4708 17.0886 16.4708 18.4816C16.4708 19.1899 16.424 19.7693 16.4298 20.4775C16.4298 21.0219 16.3069 21.7301 16.3069 22.5202C16.3069 22.6256 16.3538 22.608 16.4064 22.7017L16.4767 22.8305C16.5469 22.9241 16.6406 23.0002 16.7869 23.0002H25.385C25.6309 23.0002 25.824 22.7251 25.8591 22.5144C25.9177 22.1632 25.7421 20.0737 25.666 19.7576C25.4377 19.7576 25.3909 19.7166 25.2563 19.8337L25.1392 19.9566C25.1158 19.98 25.1099 19.9859 25.0807 20.0151C25.0631 20.0385 25.0397 20.0561 25.0221 20.0737L24.829 20.2434C24.3315 20.7351 23.9744 20.22 23.635 19.8688L18.9876 15.122C18.6072 14.7006 19.2218 14.3084 19.6373 13.8928L21.3581 12.213C21.4342 12.1369 21.481 12.0901 21.5571 12.014L22.002 11.575C22.0605 11.5223 22.0605 11.5223 22.1073 11.4814L22.4468 11.1419C22.6868 10.8961 23.0087 10.8317 23.2662 11.1185C23.3072 11.1653 23.3013 11.1653 23.3599 11.2238L25.1451 13.0441C25.2211 13.1202 25.2797 13.167 25.3733 13.2548C25.5431 13.4246 25.6543 13.5299 25.7889 13.7231C25.6192 13.8109 25.5255 13.9514 25.3733 14.0684C25.3675 14.0743 25.3616 14.0801 25.3499 14.086L25.3089 14.1211C25.3031 14.127 25.2914 14.1328 25.2855 14.1387C25.2797 14.1445 25.2738 14.1562 25.268 14.1621L24.6475 14.7006C24.6358 14.7064 24.63 14.7123 24.6241 14.7181C24.6183 14.724 24.6066 14.7298 24.6007 14.7357L24.0564 15.2273C24.0505 15.2332 24.0388 15.239 24.033 15.2449C24.0271 15.2507 24.0154 15.2566 24.0096 15.2624L23.7169 15.5317C23.7111 15.5375 23.6993 15.5434 23.6935 15.5492L23.3774 15.8302C23.155 16.0409 23.1082 16.1346 23.1082 16.4389C23.1082 16.5852 23.196 16.6613 23.2721 16.755L23.3891 16.8779C23.4418 16.9364 23.4535 16.9598 23.5238 17.0242L24.7178 18.306C25.1802 18.6397 25.3499 18.4875 25.8708 18.0075L27.738 16.3511C27.7438 16.3453 27.7497 16.3394 27.7555 16.3336L28.692 15.5083C28.6979 15.5024 28.7096 15.4907 28.7154 15.4849C28.7798 15.4322 28.8091 15.3971 28.8793 15.3327C28.891 15.321 28.9378 15.28 28.9437 15.2742L29.5992 14.4957C29.7865 14.1972 29.7807 13.6411 29.6812 13.3017C29.6109 13.0675 29.1837 12.5525 29.0081 12.3359L28.1769 11.4462C28.1711 11.4404 28.1652 11.4345 28.1594 11.4287L26.4737 9.59668C26.462 9.59083 26.4386 9.56156 26.4327 9.55571C26.4269 9.54986 26.421 9.53815 26.4152 9.5323L26.3801 9.48547C26.3742 9.47962 26.3683 9.47377 26.3625 9.46206C26.1459 9.19867 25.6074 8.5841 25.3148 8.43192L25.1099 8.31486C25.0221 8.26218 24.9636 8.24462 24.829 8.24462H17.3078C17.1498 8.24462 17.1029 8.26803 16.9976 8.33242C16.6932 8.52557 16.4884 8.65434 16.225 8.91772C16.2074 8.93528 16.184 8.95284 16.1606 8.97626C16.1547 8.98211 16.1489 8.99381 16.143 8.99381L16.0318 9.08746C16.026 9.09332 16.0201 9.09917 16.0084 9.10502C15.9382 9.16941 15.9909 9.12258 15.9499 9.16355L15.2651 9.83666C15.2592 9.84251 15.2475 9.84836 15.2417 9.85421L15.0836 10.0181C14.6739 10.3868 14.3052 10.779 13.8838 11.136C13.7257 11.2707 13.8194 11.2414 13.5501 11.2414C13.5209 11.136 13.474 11.1243 13.398 11.0365C13.3687 11.0014 13.357 10.978 13.3219 10.9487L10.846 8.42607C10.5826 8.13927 9.41787 6.92183 9.27155 6.92183C8.9028 6.92183 8.87939 6.92183 8.58088 7.19692L8.53991 7.23204C8.53406 7.2379 8.52235 7.24375 8.5165 7.2496C8.51065 7.25546 8.5048 7.26716 8.49894 7.27301C8.29994 7.46617 8.3175 7.35496 8.27067 7.55981L7.00641 6.30726C6.96544 6.26629 6.983 6.28385 6.94203 6.24873L5.79483 5.03714C5.78897 5.03129 5.78312 5.02544 5.77727 5.01958L5.42023 4.65084C5.33243 4.56305 5.29146 4.52207 5.20952 4.42257L4.44862 3.6207C4.4018 3.56802 4.38424 3.55632 4.33156 3.50364C4.24962 3.4217 4.18523 3.35731 4.10914 3.28122L3.66431 2.80713C3.65846 2.80127 3.65261 2.79542 3.64675 2.78957C3.61749 2.75445 3.61163 2.7486 3.58822 2.72518L3.2546 2.37985C3.20192 2.32718 3.19021 2.30962 3.13754 2.25694L2.99706 2.11646C2.99121 2.11061 2.9795 2.10476 2.97365 2.09891L2.64588 1.74772C2.60491 1.70675 2.62247 1.72431 2.58735 1.68919L1.94351 1.01024C1.69768 0.764407 1.2587 0.138129 0.878253 0.530285C0.81387 0.594668 0.731927 0.77026 0.726074 0.84635C0.708514 1.07462 0.884106 1.22095 1.01873 1.37898C1.02458 1.38483 1.03043 1.39068 1.03629 1.39654L1.0714 1.44336C1.07726 1.44922 1.08311 1.46092 1.08896 1.46677C1.09482 1.47263 1.10067 1.47848 1.10652 1.48433C1.12994 1.5136 1.12994 1.51945 1.16505 1.54872L3.51798 3.9953C3.52384 4.00115 3.52969 4.01286 3.53554 4.01871L5.30902 5.88584C5.3617 5.93852 5.36755 5.95022 5.42608 6.00875L5.8358 6.43603C5.84165 6.44188 5.8475 6.45359 5.85336 6.45944L6.81911 7.45446C6.97715 7.61249 7.4688 8.05147 7.4688 8.20365Z"
14
+ fill="#F95454"
15
+ />
16
+ <path
17
+ fillRule="evenodd"
18
+ clipRule="evenodd"
19
+ d="M17.4661 4.12155C17.4661 5.6492 17.5129 4.72441 17.63 5.5614C17.6475 5.70773 17.8172 6.05891 17.8933 6.17597C18.0104 6.34571 17.8933 6.26962 18.0631 6.48619L18.9644 7.42268C19.1049 7.53974 19.4912 7.77386 19.6785 7.83239C19.8834 7.89092 19.8366 7.91433 19.9829 7.96701C20.1116 8.01384 20.2112 7.98457 20.3633 8.02554C20.8491 8.14846 20.9603 8.20699 21.5047 8.11919C21.6978 8.08993 21.6744 8.05481 21.8442 8.01384C22.008 7.97872 22.0841 8.01384 22.2246 7.9553L23.3484 7.32317C23.7523 7.02467 24.0039 6.65592 24.2381 6.25206C24.2439 6.24621 24.2498 6.2345 24.2556 6.22865L24.5249 5.6609C24.5424 5.56725 24.5366 5.52043 24.5541 5.44434C24.5892 5.2746 24.6244 5.35069 24.6712 5.12242C24.7414 4.75368 24.7473 3.99863 24.5951 3.67086C24.5073 3.48356 24.5717 3.52454 24.5249 3.34309C24.4839 3.18506 24.4371 3.1792 24.3844 3.04458C24.2381 2.68169 24.3317 2.92752 24.1795 2.64658L24.1503 2.59975C23.9805 2.3071 23.8225 2.14321 23.5942 1.91494C23.5884 1.90909 23.5767 1.90324 23.5708 1.89738C23.2664 1.58717 22.9211 1.37646 22.5348 1.21258C22.3826 1.14234 22.4587 1.11893 22.2597 1.08381C21.7973 1.00772 21.9729 0.919922 21.5866 0.919922C19.6434 0.919922 20.6677 0.978453 19.9478 1.08381C19.7605 1.10722 19.3508 1.33549 19.1635 1.45255C19.1517 1.4584 19.1459 1.46426 19.1342 1.47011L18.7011 1.79203C18.4084 2.032 18.0338 2.54707 17.8465 2.89826C17.7587 3.05629 17.8231 3.04458 17.706 3.23774C17.6826 3.27285 17.7002 3.22018 17.6592 3.30797C17.5948 3.46015 17.6417 3.58892 17.5539 3.80548C17.5012 3.9284 17.4661 3.9401 17.4661 4.12155Z"
20
+ fill="#F95454"
21
+ />
22
+ </svg>
23
+ );
24
+ };
25
+
26
+ export default InstructorIcon;
@@ -4,12 +4,26 @@ import { CourseListWrapper } from "./styles";
4
4
  import PropTypes from "prop-types";
5
5
 
6
6
  const CourseList = ({ courses, onCourseSelect }) => {
7
- const [selectedCourseId, setSelectedCourseId] = useState(null);
7
+ // const [selectedCourseId, setSelectedCourseId] = useState(null);
8
+ const [selectedCourseIds, setSelectedCourseIds] = useState([]);
9
+
10
+ // const handleCourseSelect = (courseId) => {
11
+ // setSelectedCourseId(courseId);
12
+ // console.log(selectedCourseId);
13
+ // // onCourseSelect(courseId);
14
+ // };
8
15
 
9
16
  const handleCourseSelect = (courseId) => {
10
- setSelectedCourseId(courseId);
11
- console.log(selectedCourseId);
12
- // onCourseSelect(courseId);
17
+ if (selectedCourseIds.includes(courseId)) {
18
+ setSelectedCourseIds((prevSelected) =>
19
+ prevSelected.filter((id) => id !== courseId)
20
+ );
21
+ } else {
22
+ // Otherwise, add the course ID to the array
23
+ setSelectedCourseIds((prevSelected) => [...prevSelected, courseId]);
24
+ }
25
+ console.log(selectedCourseIds);
26
+ // onCourseSelect(courseId); // Adapt this callback for multiple selections if necessary
13
27
  };
14
28
 
15
29
  return (
@@ -18,7 +32,7 @@ const CourseList = ({ courses, onCourseSelect }) => {
18
32
  <div className="card" key={course.id} onClick={() => handleCourseSelect(course.id)}>
19
33
  <CourseCard
20
34
  course={course}
21
- isSelected={selectedCourseId === course.id}
35
+ isSelected={selectedCourseIds.includes(course.id)}
22
36
  />
23
37
  </div>
24
38
  ))}
@@ -4,8 +4,8 @@ export const CourseListWrapper = styled.div`
4
4
  display: flex;
5
5
  flex-wrap: wrap;
6
6
  gap: 20px;
7
- overflow-y: scroll;
8
- overflow-x: hidden;
7
+ /* overflow-y: auto;
8
+ overflow-x: hidden; */
9
9
  height: 60%;
10
10
  max-width: 1200px;
11
11
  margin: 20px auto;
@@ -8,22 +8,27 @@ export const CardWrapper = styled.div`
8
8
  width: 280px;
9
9
  height: auto;
10
10
  gap: 20px;
11
- border: ${({selected}) => selected ? "5px solid #FEF1CB" : "1px solid #DFE6E6"};
11
+ border: 1px solid #DFE6E6;
12
12
  background: #fff;
13
- border-radius: 29.3674px;
13
+ border-radius: 30px;
14
14
  padding: 30px;
15
15
  display: flex;
16
16
  flex-direction: column;
17
17
  justify-content: space-between;
18
- transition: 0.3s ease-in-out;
19
18
  cursor: pointer;
19
+ transition: all 0.2s ease-in-out;
20
20
 
21
+ /* These properties will handle the border without making the card expand. */
22
+ margin: ${({ selected }) => selected ? "-4px" : "0"};
23
+ border-width: ${({ selected }) => selected ? "5px" : "1px"};
24
+ border-color: ${({ selected }) => selected ? "#FEF1CB" : "#DFE6E6"};
21
25
 
22
26
  &:hover {
23
- border: 5px solid #FEF1CB;
27
+ border-color: #FEF1CB;
24
28
  }
25
29
  `;
26
30
 
31
+
27
32
  export const Title = styled.h3`
28
33
  font-size: 16px;
29
34
  font-weight: 800;
@@ -0,0 +1,5 @@
1
+ import figma from "./figma.png";
2
+ import frankUniversity from "./frank-university.png";
3
+ import linkedin from "./linkedin.png";
4
+
5
+ export { figma, frankUniversity, linkedin };
@@ -0,0 +1,132 @@
1
+ import styled from "styled-components";
2
+ import shield from "../../../../assets/images/warning-shield.png";
3
+ import ButtonComponent from "./../../../button";
4
+ import CloseIcon from "../../../../assets/svg/closeIcon";
5
+ import InstructorIcon from "../../../../assets/svg/intructorIcon";
6
+
7
+ const ExpiryModal = ({ close, btnText, children, onClick }) => {
8
+ return (
9
+ <Container>
10
+ <Wrapper>
11
+ <span onClick={close}>
12
+ <CloseIcon />
13
+ </span>
14
+ <Content>
15
+ <SideHero>
16
+ <img src={shield} alt="" />
17
+ </SideHero>
18
+ <Details>
19
+ <Box>
20
+ <InstructorIcon />
21
+ <p>Instructor</p>
22
+ </Box>
23
+ <Children>{children}</Children>
24
+ <ButtonComponent text={btnText} onClick={onClick} />
25
+ </Details>
26
+ </Content>
27
+ </Wrapper>
28
+ </Container>
29
+ );
30
+ };
31
+
32
+ export default ExpiryModal;
33
+
34
+ const Container = styled.div`
35
+ display: grid;
36
+ place-items: center;
37
+ position: fixed;
38
+ z-index: 9999;
39
+ inset: 0;
40
+ background-color: rgba(0, 0, 0, 0.15);
41
+ `;
42
+
43
+ const Wrapper = styled.div`
44
+ width: 748px;
45
+ display: flex;
46
+ flex-direction: column;
47
+ align-items: flex-end;
48
+ gap: 12px;
49
+ span {
50
+ display: inline-flex;
51
+ width: 40px;
52
+ height: 40px;
53
+ justify-content: center;
54
+ align-items: center;
55
+ border-radius: 50%;
56
+ cursor: pointer;
57
+ background: #fff;
58
+ }
59
+ `;
60
+
61
+ const Content = styled.div`
62
+ width: 100%;
63
+ height: 438px;
64
+ background-color: #fff;
65
+ border-radius: 30px;
66
+ display: flex;
67
+ `;
68
+
69
+ const SideHero = styled.div`
70
+ flex: 1;
71
+ max-width: 305px;
72
+ display: grid;
73
+ place-items: center;
74
+ background: rgba(249, 84, 84, 0.1);
75
+ `;
76
+
77
+ const Details = styled.div`
78
+ padding: 40px;
79
+ flex: 1;
80
+ display: flex;
81
+ flex-direction: column;
82
+ justify-content: space-between;
83
+ button {
84
+ width: 100%;
85
+ font-size: 14px;
86
+ height: 52px;
87
+ box-shadow: 0px 10px 20px 0px rgba(254, 191, 16, 0.25);
88
+ }
89
+ `;
90
+
91
+ const Box = styled.div`
92
+ border-radius: 15px;
93
+ background: #f5f7f7;
94
+ width: 81px;
95
+ height: 81px;
96
+ display: flex;
97
+ flex-direction: column;
98
+ justify-content: center;
99
+ align-items: center;
100
+ svg {
101
+ display: inline-block;
102
+ margin-right: 10px;
103
+ }
104
+ p {
105
+ color: #f95454;
106
+ font-size: 12px;
107
+ font-weight: 600;
108
+ }
109
+ `;
110
+
111
+ const Children = styled.div`
112
+ width: 100%;
113
+ .title {
114
+ font-size: 22px;
115
+ font-weight: 700;
116
+ }
117
+ .danger {
118
+ color: #f95454;
119
+ }
120
+ .desc,
121
+ .sub_title {
122
+ font-size: 16px;
123
+
124
+ line-height: 20px;
125
+ }
126
+ .desc {
127
+ font-weight: 600;
128
+ }
129
+ .sub_title {
130
+ font-weight: 700;
131
+ }
132
+ `;
@@ -0,0 +1,120 @@
1
+ import styled from "styled-components";
2
+ import CloseIcon from "../../../../assets/svg/closeIcon";
3
+ import Button from "../../../button";
4
+ import oops from "../../../../assets/images/oops.png";
5
+
6
+ const RenewModal = ({
7
+ img,
8
+ close,
9
+ titleText,
10
+ titleColor,
11
+ btn1Text,
12
+ btn2Text,
13
+ btn1onClick,
14
+ btn2onClick,
15
+ message,
16
+ }) => {
17
+ return (
18
+ <Container>
19
+ <Wrapper>
20
+ <span onClick={close}>
21
+ <CloseIcon />
22
+ </span>
23
+ <Content>
24
+ <img src={img || oops} alt="" />
25
+ <h2
26
+ style={{
27
+ color: titleColor || "#00C2C2",
28
+ }}
29
+ >
30
+ {titleText || "Oops!"}
31
+ </h2>
32
+ <p>{message}</p>
33
+ <BtnGroup>
34
+ <Button
35
+ type="secondary"
36
+ text={btn1Text || "Select Plans"}
37
+ onClick={btn1onClick}
38
+ />
39
+ <Button
40
+ text={btn2Text || "Renew Subscription"}
41
+ onClick={btn2onClick}
42
+ />
43
+ </BtnGroup>
44
+ </Content>
45
+ </Wrapper>
46
+ </Container>
47
+ );
48
+ };
49
+
50
+ export default RenewModal;
51
+
52
+ const Container = styled.div`
53
+ display: grid;
54
+ place-items: center;
55
+ position: fixed;
56
+ z-index: 9999;
57
+ inset: 0;
58
+ background-color: rgba(0, 0, 0, 0.15);
59
+ `;
60
+
61
+ const Wrapper = styled.div`
62
+ width: 820px;
63
+ display: flex;
64
+ flex-direction: column;
65
+ align-items: flex-end;
66
+ gap: 12px;
67
+ span {
68
+ display: inline-flex;
69
+ width: 40px;
70
+ height: 40px;
71
+ justify-content: center;
72
+ align-items: center;
73
+ border-radius: 50%;
74
+ cursor: pointer;
75
+ background: #fff;
76
+ }
77
+ `;
78
+ const Content = styled.div`
79
+ display: flex;
80
+ flex-direction: column;
81
+ align-items: center;
82
+ padding: 45px 26px;
83
+ width: 100%;
84
+ min-height: 464px;
85
+ background-color: #fff;
86
+ border-radius: 30px;
87
+ display: flex;
88
+ img {
89
+ width: 125px;
90
+ height: 125px;
91
+ object-fit: contain;
92
+ }
93
+ h2 {
94
+ margin-top: 13px;
95
+ margin-bottom: 15px;
96
+ font-size: 40px;
97
+ font-weight: 700;
98
+ }
99
+ p {
100
+ max-width: 754px;
101
+ font-size: 24px;
102
+ text-align: center;
103
+ font-weight: 500;
104
+ line-height: 35px; /* 36.336px */
105
+ }
106
+ `;
107
+
108
+ const BtnGroup = styled.div`
109
+ display: flex;
110
+ gap: 20px;
111
+ margin-top: auto;
112
+
113
+ button {
114
+ height: 52px;
115
+ min-width: 168px;
116
+ padding: 0 20px;
117
+ font-size: 14px;
118
+ box-shadow: 0px 10px 20px 0px rgba(254, 191, 16, 0.25);
119
+ }
120
+ `;
@@ -0,0 +1,300 @@
1
+ import { useEffect, useState } from "react";
2
+ import styled from "styled-components";
3
+ import ExpiryModal from "./components/expiry modal";
4
+ import Search from "../searchBar";
5
+ import { figma, frankUniversity, linkedin } from "./brands-logo";
6
+ import ArrowDown from "../../assets/svg/arrowDown";
7
+ import RenewModal from "./components/renew modal";
8
+
9
+ const InstructorAccountSwitcher = ({ setAccountType }) => {
10
+ const [expiryFlow, setExpiryFlow] = useState();
11
+ const [switchValue, setSwitchValue] = useState(null);
12
+ const [selectedValue, setSelectedValue] = useState({
13
+ name: "Figma Learning",
14
+ count: 0,
15
+ image: figma,
16
+ });
17
+
18
+ const [dropdown, setDropdown] = useState(false);
19
+ const dataDropdown = [
20
+ { name: "Figma Learning", count: 0, image: figma },
21
+ { name: "Linkedin Learning", count: 3, image: linkedin },
22
+ { name: "Frank University", count: 0, image: frankUniversity },
23
+ ];
24
+
25
+ const handleSwitch = (value) => {
26
+ if (value === 2) {
27
+ setSwitchValue("affiliates");
28
+ localStorage.setItem("affiliates", true);
29
+ } else {
30
+ setSwitchValue("instructor");
31
+ localStorage.removeItem("affiliates");
32
+ }
33
+ };
34
+ useEffect(() => {
35
+ const value = JSON.stringify(localStorage.getItem("affiliates"));
36
+ if (value) {
37
+ setSwitchValue("affiliates");
38
+ } else {
39
+ setSwitchValue("instructor");
40
+ }
41
+ }, []);
42
+
43
+ useEffect(() => {
44
+ const value = JSON.stringify(localStorage.getItem("affiliates"));
45
+ if (value) {
46
+ setAccountType && setAccountType(switchValue);
47
+ } else {
48
+ setAccountType && setAccountType(switchValue);
49
+ }
50
+ }, [switchValue]);
51
+
52
+ return (
53
+ <>
54
+ {expiryFlow === "renew" && (
55
+ <RenewModal
56
+ close={() => setExpiryFlow(null)}
57
+ message="Oops, you have to renew your Instructor plan to continue to
58
+ dashboard."
59
+ />
60
+ )}
61
+ {expiryFlow === "expiry" && (
62
+ <ExpiryModal
63
+ btnText="Renew Subscription"
64
+ close={() => setExpiryFlow("renew")}
65
+ >
66
+ <ExpiryModalContent>
67
+ <p className="title danger">
68
+ Your subscription to Learngual Premium has expired
69
+ </p>
70
+ <p className="desc">
71
+ Your students will no longer be able to access your courses after
72
+ </p>
73
+ <p className="sub_title danger">47h - 22m - 59s</p>
74
+ </ExpiryModalContent>
75
+ </ExpiryModal>
76
+ )}
77
+ <Container>
78
+ <div className="left">
79
+ {switchValue !== "affiliates" && (
80
+ <p onClick={() => setExpiryFlow("expiry")}>Frank Language Expert</p>
81
+ )}
82
+ {switchValue === "affiliates" && (
83
+ <AffiliatesDropDown>
84
+ <div className="selected" onClick={() => setDropdown(!dropdown)}>
85
+ <div>
86
+ <img src={selectedValue.image} alt="" />
87
+ <p>{selectedValue.name}</p>
88
+ </div>
89
+ <ArrowDown />
90
+ </div>
91
+
92
+ {dropdown && switchValue === "affiliates" ? (
93
+ <AffiliatesDropDownWrapper>
94
+ <div className="search_wrapper">
95
+ <Search placeholder="Search Affiliates" />
96
+ </div>
97
+ <ul>
98
+ {dataDropdown?.map((item, idx) => (
99
+ <li
100
+ key={idx}
101
+ onClick={() => {
102
+ setSelectedValue(item);
103
+ setDropdown(false);
104
+ }}
105
+ >
106
+ <div className="left" key={idx}>
107
+ <img src={item.image} alt="" />
108
+ <p>{item.name}</p>
109
+ </div>
110
+ {item.count ? <span>{item.count}</span> : null}
111
+ </li>
112
+ ))}
113
+ </ul>
114
+ </AffiliatesDropDownWrapper>
115
+ ) : null}
116
+ </AffiliatesDropDown>
117
+ )}
118
+ </div>
119
+ <div className="btn__wrapper">
120
+ <button
121
+ className={switchValue !== "affiliates" ? "active" : ""}
122
+ onClick={() => handleSwitch(1)}
123
+ >
124
+ <span>My Account</span>
125
+ <span className="circle"></span>
126
+ </button>
127
+ <button
128
+ className={switchValue === "affiliates" ? "active" : ""}
129
+ onClick={() => handleSwitch(2)}
130
+ >
131
+ <span>Affiliates</span>
132
+ <span className="circle"></span>
133
+ </button>
134
+ </div>
135
+ </Container>
136
+ </>
137
+ );
138
+ };
139
+
140
+ const Container = styled.div`
141
+ display: flex;
142
+ justify-content: space-between;
143
+ align-items: center;
144
+ padding: 0 24px;
145
+ width: 100%;
146
+ background: #ffffff;
147
+ border-radius: 25px;
148
+ height: 60px;
149
+
150
+ .left {
151
+ > p {
152
+ cursor: pointer;
153
+ }
154
+ p {
155
+ font-size: 20px;
156
+ font-weight: 600;
157
+ color: #00c2c2;
158
+ }
159
+ }
160
+
161
+ .btn__wrapper {
162
+ background: #dfe6e6;
163
+ border-radius: 10px;
164
+ overflow: hidden;
165
+ display: flex;
166
+ button {
167
+ font-size: 14px;
168
+ line-height: 30px;
169
+ font-weight: 700;
170
+ padding: 4px 15px;
171
+ color: #4a4d4d;
172
+ display: flex;
173
+ align-items: center;
174
+ gap: 10px;
175
+ border: none;
176
+ background: transparent;
177
+ cursor: pointer;
178
+ height: 40px;
179
+ span {
180
+ color: #4a4d4d;
181
+ }
182
+ .circle {
183
+ width: 8px;
184
+ height: 8px;
185
+ display: inline-block;
186
+ background-color: #febf10;
187
+ border-radius: 50%;
188
+ }
189
+ &.active {
190
+ background: #00c2c2;
191
+
192
+ border-radius: 10px;
193
+ span {
194
+ color: white;
195
+ }
196
+ }
197
+ }
198
+ }
199
+ `;
200
+
201
+ const AffiliatesDropDown = styled.div`
202
+ position: relative;
203
+ .selected {
204
+ display: flex;
205
+ align-items: center;
206
+ gap: 25px;
207
+ cursor: pointer;
208
+ svg {
209
+ width: 24px;
210
+ height: 24px;
211
+ path {
212
+ fill: #7c8080;
213
+ }
214
+ }
215
+
216
+ > div {
217
+ display: flex;
218
+ align-items: center;
219
+ gap: 10px;
220
+ img {
221
+ width: 36px;
222
+ height: 36px;
223
+ }
224
+ p {
225
+ color: #00c2c2;
226
+ font-size: 20px;
227
+ font-weight: 600;
228
+ }
229
+ }
230
+ }
231
+ `;
232
+
233
+ const AffiliatesDropDownWrapper = styled.div`
234
+ position: absolute;
235
+ left: 40px;
236
+ border-radius: 15px;
237
+ border: 1px solid #c6cccc;
238
+ background: #fff;
239
+ box-shadow: 0px 10px 20px 0px rgba(139, 139, 139, 0.25);
240
+ width: 351px;
241
+ z-index: 69;
242
+ padding: 20px;
243
+ ul {
244
+ list-style: none;
245
+ li {
246
+ height: 50px;
247
+ width: 100%;
248
+ display: flex;
249
+ align-items: center;
250
+ border-top: 1px solid #f5f7f7;
251
+ border-bottom: 1px solid #f5f7f7;
252
+ cursor: pointer;
253
+
254
+ &:first-child {
255
+ border-top: none;
256
+ }
257
+ &:last-child {
258
+ border-bottom: none;
259
+ }
260
+
261
+ > .left {
262
+ display: flex;
263
+ align-items: center;
264
+ gap: 10px;
265
+ flex: 1;
266
+ p {
267
+ color: #4a4d4d;
268
+ font-size: 14px;
269
+ font-weight: 600;
270
+ }
271
+ }
272
+ span {
273
+ border-radius: 17px;
274
+ background: #00c2c2;
275
+ min-width: 26px;
276
+ height: 26px;
277
+ display: flex;
278
+ justify-content: center;
279
+ align-items: center;
280
+ color: #fff;
281
+ text-align: center;
282
+ font-size: 12px;
283
+ font-weight: 700;
284
+ padding: 0 10px;
285
+ }
286
+ }
287
+ }
288
+ `;
289
+
290
+ const ExpiryModalContent = styled.div`
291
+ padding-bottom: 30px;
292
+ > .title {
293
+ margin-bottom: 25px;
294
+ }
295
+ > .desc {
296
+ margin: 10px;
297
+ }
298
+ `;
299
+
300
+ export default InstructorAccountSwitcher;