l-min-components 1.0.150 → 1.0.156

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.150",
3
+ "version": "1.0.156",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -1,15 +1,26 @@
1
- import React from "react";
1
+ import React, { Fragment, useState } from "react";
2
2
  import CourseCard from "../coursecard";
3
3
  import { CourseListWrapper } from "./styles";
4
-
5
4
  import PropTypes from "prop-types";
6
5
 
6
+ const CourseList = ({ courses, onCourseSelect }) => {
7
+ const [selectedCourseId, setSelectedCourseId] = useState(null);
8
+
9
+ const handleCourseSelect = (courseId) => {
10
+ setSelectedCourseId(courseId);
11
+ console.log(selectedCourseId);
12
+ // onCourseSelect(courseId);
13
+ };
7
14
 
8
- const CourseList = ({courses}) => {
9
15
  return (
10
16
  <CourseListWrapper>
11
17
  {courses.map((course) => (
12
- <CourseCard key={course.id} course={course} />
18
+ <div className="card" key={course.id} onClick={() => handleCourseSelect(course.id)}>
19
+ <CourseCard
20
+ course={course}
21
+ isSelected={selectedCourseId === course.id}
22
+ />
23
+ </div>
13
24
  ))}
14
25
  </CourseListWrapper>
15
26
  );
@@ -25,8 +36,7 @@ CourseList.propTypes = {
25
36
  learnersCount: PropTypes.number.isRequired,
26
37
  })
27
38
  ).isRequired,
39
+ onCourseSelect: PropTypes.func.isRequired,
28
40
  };
29
41
 
30
42
  export default CourseList;
31
-
32
-
@@ -3,8 +3,31 @@ import styled from "styled-components";
3
3
  export const CourseListWrapper = styled.div`
4
4
  display: flex;
5
5
  flex-wrap: wrap;
6
- justify-content: space-between;
6
+ gap: 20px;
7
+ overflow-y: scroll;
8
+ overflow-x: hidden;
9
+ height: 60%;
7
10
  max-width: 1200px;
8
- margin: 0 auto;
9
- padding: 20px;
11
+ margin: 20px auto;
12
+
13
+
14
+
15
+ /* Style the scrollbar */
16
+ ::-webkit-scrollbar {
17
+ width: 8px;
18
+ }
19
+
20
+ ::-webkit-scrollbar-thumb {
21
+ background-color: #888;
22
+ border-radius: 4px;
23
+ }
24
+
25
+ ::-webkit-scrollbar-track {
26
+ background-color: #f2f2f2;
27
+ }
28
+
29
+ ::-webkit-scrollbar-thumb:hover {
30
+ background-color: #555;
31
+ }
32
+
10
33
  `;
@@ -19,11 +19,11 @@ const formatLearnersCount = (count) => {
19
19
  };
20
20
 
21
21
 
22
- const CourseCard = ({ course }) => {
22
+ const CourseCard = ({ course, isSelected }) => {
23
23
  const { id, title, endDate, rating, learnersCount } = course;
24
24
 
25
25
  return (
26
- <CardWrapper to={`/courses/${id}`}>
26
+ <CardWrapper selected={isSelected}>
27
27
  <Title>{title}</Title>
28
28
  <EndDate>
29
29
  <span>Course Ends: </span>
@@ -2,25 +2,25 @@ import styled from "styled-components";
2
2
  import { BsStarFill } from "react-icons/bs";
3
3
  import { NavLink } from "react-router-dom";
4
4
 
5
- export const CardWrapper = styled(NavLink)`
6
- text-decoration: none;
7
- color: #333;
5
+ export const CardWrapper = styled.div`
6
+ text-decoration: none;
7
+ color: #333;
8
8
  width: 280px;
9
9
  height: auto;
10
10
  gap: 20px;
11
-
12
- border: 5px solid #ffffff;
11
+ border: ${({selected}) => selected ? "5px solid #FEF1CB" : "1px solid #DFE6E6"};
13
12
  background: #fff;
14
- border-radius: 25px;
13
+ border-radius: 29.3674px;
15
14
  padding: 30px;
16
15
  display: flex;
17
16
  flex-direction: column;
18
17
  justify-content: space-between;
19
18
  transition: 0.3s ease-in-out;
20
19
  cursor: pointer;
20
+
21
21
 
22
22
  &:hover {
23
- border: 5px solid #f5d508;
23
+ border: 5px solid #FEF1CB;
24
24
  }
25
25
  `;
26
26
 
@@ -15,6 +15,7 @@ import {
15
15
  * className: string,
16
16
  * onSelect: Function,
17
17
  * inputPlaceHolder: string,
18
+ * default: {name: string | number, [key: string]: string | number}
18
19
  * }} props - properties of the dropdown component
19
20
  */
20
21
  // dropdownData - Array of objects with property values of name and value
@@ -26,7 +27,7 @@ import {
26
27
 
27
28
  const DropDownComponent = (props) => {
28
29
  // select state that dictates the current value.
29
- const [selected, setSelected] = useState();
30
+ const [selected, setSelected] = useState(props.default);
30
31
 
31
32
  // dropdown state that dictates if dropdown is dropped or not.
32
33
  const [dropdown, setDropdown] = useState();
@@ -65,8 +66,7 @@ const DropDownComponent = (props) => {
65
66
  onClick={() => {
66
67
  setSelected(dropdownItem);
67
68
  setDropdown();
68
- }}
69
- >
69
+ }}>
70
70
  <span>{dropdownItem?.name}</span>
71
71
  {selected === dropdownItem && <Tick />}
72
72
  </DropDownItem>
@@ -83,8 +83,7 @@ const DropDownComponent = (props) => {
83
83
  onClick={() => {
84
84
  setSelected(dropdownItem);
85
85
  setDropdown();
86
- }}
87
- >
86
+ }}>
88
87
  <span>{dropdownItem?.name}</span>
89
88
  {selected === dropdownItem && <Tick />}
90
89
  </DropDownItem>
@@ -106,8 +105,7 @@ export const DownIcon = ({ width, height, fill, onClick }) => {
106
105
  viewBox="0 0 14 8"
107
106
  fill="none"
108
107
  xmlns="http://www.w3.org/2000/svg"
109
- onClick={onClick}
110
- >
108
+ onClick={onClick}>
111
109
  <path
112
110
  d="M1 1L7 7L13 1"
113
111
  stroke={fill || "#18191B"}
@@ -125,8 +123,7 @@ export const Tick = ({ size, stroke }) => {
125
123
  height={size || "16"}
126
124
  viewBox="0 0 16 16"
127
125
  fill="none"
128
- xmlns="http://www.w3.org/2000/svg"
129
- >
126
+ xmlns="http://www.w3.org/2000/svg">
130
127
  <path
131
128
  d="M12.3828 4.23828L5.82031 11.7383L3.00781 8.92578"
132
129
  stroke={stroke || "white"}
@@ -52,6 +52,7 @@ const SearchBar = ({
52
52
  heightSize={restProps.heightSize}
53
53
  widthSize={restProps.widthSize}
54
54
  borderRadius={restProps.borderRadius}
55
+ border={restProps.border}
55
56
  outlineColor={restProps.outlineColor}
56
57
  >
57
58
  <SearchIcon
@@ -66,6 +67,7 @@ const SearchBar = ({
66
67
  onChange={handleInputChange}
67
68
  onKeyPress={handleEnterPress}
68
69
  borderRadius={restProps.borderRadius || "12px"}
70
+ border={restProps.border || "1px solid #DFE6E6"}
69
71
  heightSize={restProps.heightSize || "50px"}
70
72
  widthSize={restProps.widthSize || "100%"}
71
73
  />
@@ -95,6 +97,7 @@ SearchBar.propTypes = {
95
97
  heightSize:PropTypes.string,
96
98
  widthSize: PropTypes.string,
97
99
  borderRadius: PropTypes.string,
100
+ border: PropTypes.string,
98
101
  outlineColor: PropTypes.string,
99
102
  };
100
103
 
@@ -15,7 +15,7 @@ export const SearchBarContainer = styled.div`
15
15
  position: relative;
16
16
  height: ${({ heightSize }) => heightSize || "50px"};
17
17
  width: ${({ widthSize }) => widthSize || "100%"};
18
-
18
+ border: ${({ border}) => border || "1px solid #DFE6E6"};
19
19
  border-radius: ${({ borderRadius }) => borderRadius || "12px"};
20
20
  background-color: #FFFFFF;
21
21
  transition: box-shadow 0.2s ease;
@@ -13,13 +13,13 @@ import ButtonComponent from "../button";
13
13
  const SuccessCard = (props) => {
14
14
  return (
15
15
  <Card style={props.style}>
16
- <img src={avatar} alt="Partying Face" />
16
+ <img src={props.image || avatar } alt="Partying Face" />
17
17
  <h1>{props.title} </h1>
18
18
  <h2>{props.subtitle} </h2>
19
19
  <h6> {props.info} </h6>
20
20
 
21
21
  <ButtonComponent
22
- text="Proceed to Dashboard"
22
+ text={props.text}
23
23
  styles={{ marginLeft: "auto", marginRight: "auto" }}
24
24
  onClick={props.onClick}
25
25
  />