l-min-components 1.0.354 → 1.0.360
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
|
@@ -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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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={
|
|
35
|
+
isSelected={selectedCourseIds.includes(course.id)}
|
|
22
36
|
/>
|
|
23
37
|
</div>
|
|
24
38
|
))}
|
|
@@ -8,22 +8,27 @@ export const CardWrapper = styled.div`
|
|
|
8
8
|
width: 280px;
|
|
9
9
|
height: auto;
|
|
10
10
|
gap: 20px;
|
|
11
|
-
border:
|
|
11
|
+
border: 1px solid #DFE6E6;
|
|
12
12
|
background: #fff;
|
|
13
|
-
border-radius:
|
|
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:
|
|
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;
|