-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathFavouriteDropdown.jsx
More file actions
32 lines (26 loc) · 944 Bytes
/
FavouriteDropdown.jsx
File metadata and controls
32 lines (26 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React from 'react';
function FavouritesDropdown(props) {
return (
<div className=" absolute mt-2 w-48 bg-white border border-gray-300 rounded-lg">
{props.favouriteCourses.length > 0 ? (
props.favouriteCourses.map(course => (
<div
key={course.code}
className="p-2 flex justify-between items-center">
<p>{course.name}</p>
<button
className="text-red-500 cursor-pointer"
onClick={() => removeFavourite(course.code)}>
X
</button>
</div>
))
) :
(
<div className="p-2 text-gray-500">No favourites</div>
)
}
</div>
);
}
export default FavouritesDropdown;