Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
7053CEM/front-end/src/components/FullCourseList/CourseDetails.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
121 lines (112 sloc)
3.33 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Accordion, | |
AccordionDetails, | |
AccordionSummary, | |
Button, | |
Card, | |
CardContent, | |
CardMedia, | |
Grid, | |
Typography, | |
} from "@mui/material"; | |
import React, { useState } from "react"; | |
import { useSelector } from "react-redux"; | |
import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; | |
import ApplicationForm from "./ApplicationForm"; | |
import { useNavigate } from "react-router-dom"; | |
import ArrowBackIosIcon from "@mui/icons-material/ArrowBackIos"; | |
import { Box } from "@mui/system"; | |
const CourseDetails = () => { | |
const [isApply, setIsApply] = useState(false); | |
const [isSubmit, setIsSubmit] = useState(false); | |
const navigate = useNavigate(); | |
const courseData = useSelector( | |
(state) => state?.courseDetails?.courseSelectedDetails | |
); | |
return ( | |
<Card sx={{ margin: 20, p: 5 }}> | |
<Button onClick={() => navigate(-1)}> | |
<ArrowBackIosIcon /> BACK | |
</Button> | |
{/* <CardMedia component="img" image={imageUrl} alt="Image" /> */} | |
<CardContent> | |
<Typography | |
variant="h4" | |
color="textSecondary" | |
component="p" | |
sx={{ pb: 1 }} | |
> | |
{courseData?.sessionName} | |
</Typography> | |
<Typography component="p" sx={{ pb: 1 }}> | |
{courseData?.sessionDescription} | |
</Typography> | |
<Typography component="p" sx={{ pb: 1 }}> | |
Session sessionDuration : {courseData?.sessionDuration} hrs | |
</Typography> | |
<Typography component="p" sx={{ pb: 1 }}> | |
Session Instructor : {courseData?.sessionInstructor} | |
</Typography> | |
<Typography component="p" sx={{ pb: 1 }}> | |
Location : {courseData?.location} | |
</Typography> | |
<Typography component="p" sx={{ pb: 1 }}> | |
Start Date : {courseData?.sessionStartDate} | |
</Typography> | |
<Typography component="p" sx={{ pb: 1 }}> | |
End Date : {courseData?.sessionEndDate} | |
</Typography> | |
{/* Module Section */} | |
<Accordion> | |
<AccordionSummary | |
expandIcon={<ExpandMoreIcon />} | |
aria-controls="panel1a-content" | |
id="panel1a-header" | |
> | |
<Typography>Modules and Topics</Typography> | |
</AccordionSummary> | |
<AccordionDetails> | |
<Typography>{courseData?.sessionModules}</Typography> | |
</AccordionDetails> | |
</Accordion> | |
{isApply && ( | |
<ApplicationForm | |
courseData={courseData} | |
isApply={isApply} | |
setIsApply={setIsApply} | |
setIsSubmit={setIsSubmit} | |
/> | |
)} | |
{!isApply && ( | |
<Button | |
variant="contained" | |
color="primary" | |
sx={{ | |
my: 2, | |
display: "flex", | |
justifyContent: "center", | |
textAlign: "center", | |
}} | |
onClick={() => setIsApply(true)} | |
> | |
Apply Now | |
</Button> | |
)} | |
{/* {!isApply && setIsSubmit && ( | |
<Box | |
sx={{ | |
my: 3, | |
display: "flex", | |
justifyContent: "center", | |
alignItems: "center", | |
color: "red", | |
}} | |
> | |
<Typography>Application submitted successfully</Typography> | |
</Box> | |
)} */} | |
</CardContent> | |
</Card> | |
); | |
}; | |
export default CourseDetails; |