CourseSectionList.tsx 1.01 KB
Newer Older
David Haynes's avatar
David Haynes committed
1
2
3
4
5
6
7
8
import * as React from 'react';
import CourseSection from '../util/CourseSection';
import CourseSectionCard from './CourseSectionCard';

interface CourseSectionListProps {
    courseSections: CourseSection[];
    courseSectionAction: (courseSection: CourseSection) => void;
    courseSectionActionButtonText: string;
9
    destructive?: boolean;
David Haynes's avatar
David Haynes committed
10
11
}

12
13
14
15
/**
 * Renders a list of CourseSectionCards for every course section in
 * the current schedule.
 */
David Haynes's avatar
David Haynes committed
16
17
18
19
const CourseSectionList = ({
    courseSections,
    courseSectionAction,
    courseSectionActionButtonText,
20
    destructive,
David Haynes's avatar
David Haynes committed
21
22
23
24
25
26
27
28
}: CourseSectionListProps) => (
    <div>
        {courseSections.map(courseSection => (
            <CourseSectionCard
                key={courseSection.crn}
                courseSection={courseSection}
                courseSectionAction={courseSectionAction}
                courseSectionActionButtonText={courseSectionActionButtonText}
29
                destructive={destructive}
David Haynes's avatar
David Haynes committed
30
31
32
33
34
35
            />
        ))}
    </div>
);

export default CourseSectionList;