CourseSectionCard.tsx 2.28 KB
Newer Older
1
2
import * as React from 'react';
import { Button, Card, CardBody, CardTitle, Col, Row } from 'reactstrap';
David Haynes's avatar
David Haynes committed
3
4
5
6
7
8
import CourseSection from '../util/CourseSection';

interface CourseSectionCardProps {
    courseSectionAction: (courseSection: CourseSection) => void;
    courseSection: CourseSection;
    courseSectionActionButtonText: string;
9
    destructive?: boolean;
David Haynes's avatar
David Haynes committed
10
}
11
12
13

require('../css/button-text-override.css');

David Haynes's avatar
David Haynes committed
14
15
16
17
const CourseSectionCard = ({
    courseSection,
    courseSectionAction,
    courseSectionActionButtonText,
18
    destructive,
David Haynes's avatar
David Haynes committed
19
}: CourseSectionCardProps) => (
20
    <Row className="justify-content-center">
21
22
23
24
        <Col md="9">
            <Card>
                <CardBody>
                    <CardTitle className="mb-4">
25
                        <i className="fas fa-hashtag" /> {courseSection.crn}
26
27
28
29
                    </CardTitle>
                    <Row>
                        <Col md="6">
                            <div className="mb-4">
30
31
                                <h4>{courseSection.title}</h4>
                                <p>{courseSection.name}</p>
32
                            </div>
33
                            <i className="fas fa-chalkboard-teacher fa-fw" /> {courseSection.instructor}
34
                            <br />
35
36
                            <i className="fas fa-clock fa-fw" /> {courseSection.days}, {courseSection.startTime} -{' '}
                            {courseSection.endTime}
37
                            <br />
38
                            <i className="fas fa-school fa-fw" /> {courseSection.location}
39
40
                        </Col>
                        <Col md="6">
David Haynes's avatar
David Haynes committed
41
42
                            <Button
                                onClick={() => courseSectionAction(courseSection)}
43
                                color={destructive ? 'danger' : 'primary'}
David Haynes's avatar
David Haynes committed
44
45
46
                                size="lg"
                                block
                                className="shadow-sm mt-3">
47
48
                                <i className={`fas fa-${destructive ? 'minus' : 'plus'}-circle mr-2 fa-fw`} />{' '}
                                {courseSectionActionButtonText}
49
50
51
52
53
54
55
56
57
58
                            </Button>
                        </Col>
                    </Row>
                </CardBody>
            </Card>
        </Col>
    </Row>
);

export default CourseSectionCard;