added on hover that almost works!

This commit is contained in:
Maciek Głowacki 2020-11-26 03:30:27 +01:00
parent e7e8c6efdd
commit 1ed22b60f5
2 changed files with 5 additions and 2 deletions

View File

@ -169,13 +169,15 @@ export const CourseCard = ({ course }: CourseCardProps) => {
onClick={() => onGroupClick(group, course.id)} onClick={() => onGroupClick(group, course.id)}
onMouseEnter={() => { onMouseEnter={() => {
if (group.type === GroupType.CLASS && courseClasses !== undefined) { if (group.type === GroupType.CLASS && courseClasses !== undefined) {
changeHoveredGroup(courseClasses);
changeGroupInBasket(group, course.id); changeGroupInBasket(group, course.id);
// setTimeout(()=> { changeHoveredGroup(courseClasses)},[500])
} }
if (group.type === GroupType.LECTURE && courseLecture !== undefined) { if (group.type === GroupType.LECTURE && courseLecture !== undefined) {
changeHoveredGroup(courseLecture);
changeGroupInBasket(group, course.id); changeGroupInBasket(group, course.id);
// setTimeout(()=> { changeHoveredGroup(courseLecture)},[500])
} }
}} }}
onMouseLeave={() => { onMouseLeave={() => {
if (hoveredGroup) { if (hoveredGroup) {

View File

@ -137,6 +137,7 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
basket.map((basket) => (basket.id === basketCourse.id ? { ...basket, lecture: choosenGroup } : basket)), basket.map((basket) => (basket.id === basketCourse.id ? { ...basket, lecture: choosenGroup } : basket)),
); );
} }
changeHoveredGroup(choosenGroup);
}; };
const restoreGroupInBasket = (restoreGroup: Group, courseId: number) => { const restoreGroupInBasket = (restoreGroup: Group, courseId: number) => {