-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
64 lines (57 loc) · 1.96 KB
/
Copy pathindex.tsx
File metadata and controls
64 lines (57 loc) · 1.96 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import { HiChevronRight } from 'react-icons/hi'
import { Link } from 'react-router-dom'
import * as s from './style.css'
import { usePostCourse } from '@/api/hooks/timetable'
import CookiesRate from '@/components/courseReview/CookiesRate'
import { SearchedCourse } from '@/types/course'
interface SearchLectureCardProps {
data: SearchedCourse
timetableId: number
addCourse: (courseId: number) => void
}
const SearchLectureCard = ({ data, timetableId }: SearchLectureCardProps) => {
const { mutate: addCourse } = usePostCourse()
const handleAddCourse = () => {
addCourse({ courseId: data.id, timetableId })
}
return (
<div className={s.Wrapper}>
<div className={s.Contents}>
<div className={s.Header}>
<div className={s.CourseOutline}>
<Link className={s.Syllabus} to={data.syllabus} target="_blank">
Course Plan
</Link>
<span className={s.CourseName}>{data.courseName}</span>
</div>
<div className={s.InfoAndReview}>
<span className={s.CategoryAndCredits}>
{data.category} | {data.credit} credits
</span>
<Link
className={s.Review}
target="_blank"
to={`/course-review/info?code=${data.courseCode.slice(0, 7)}&professorName=${data.professorName}`}
>
<CookiesRate rate={data.totalRate} size={8} gap={2} />
<HiChevronRight />
</Link>
</div>
</div>
<div className={s.Footer}>
<div className={s.LeftFooter}>
<span>{data.professorName}</span>
{'•'}
<span>{data.details && data.details[0]?.classroom}</span>
{'•'}
<span>{data.courseCode}</span>
</div>
<button className={s.AddButton} onClick={handleAddCourse}>
Add class
</button>
</div>
</div>
</div>
)
}
export default SearchLectureCard