import React from
"react"
;
import PropTypes from
"prop-types"
;
const Courses = ({ geekCourses, setCart }) => {
let displayCourses = geekCourses.map((course, idx) => {
return
(
<div
key={idx}
style={{
border:
"2px solid rgb(91, 222, 115)"
,
margin:
"5px"
,
width:
"20vw"
,
borderRadius:
"10px"
,
boxShadow:
"5px 3px 11px -1px rgba(0,0,0,0.46)"
,
padding:
"5px"
,
}}
>
<h3> {course.title} </h3>
<div
style={{
display:
"flex"
,
justifyContent:
"space-between"
,
alignItems:
"center"
,
}}
>
<span style={{ margin:
"5px"
}}>
<strong>Duration:</strong> {course.duration} days
</span>
<span style={{ margin:
"5px"
}}>
<strong>Price:</strong> {course.price} Rs
</span>
</div>
<div
style={{
display:
"flex"
,
justifyContent:
"space-between"
,
alignItems:
"center"
,
margin:
"10px 5px"
,
}}
>
<span style={{ margin:
"5px"
}}>
<strong>Mentor:</strong> {course.mentor}
</span>
<span style={{ margin:
"5px"
}}>
<strong>TA:</strong> {course.TA}
</span>
</div>
<div
style={{
display:
"flex"
,
justifyContent:
"space-around"
,
alignItems:
"center"
,
}}
>
<button
style={{
padding:
"2px 15px"
,
borderRadius:
"10px"
,
border:
"none"
,
backgroundColor:
"rgb(3, 252, 86)"
,
fontWeight:
"bold"
,
cursor:
"pointer"
,
}}
onClick={() => {
let newCart = {
title: course.title,
mentor: course.mentor,
price: course.price,
};
setCart(newCart);
}}
>
BUY
</button>
</div>
</div>
);
});
return
(
<>
<div style={{ width:
"60vw"
}}>
<div
style={{
display:
"flex"
,
flexWrap:
"wrap"
,
padding:
"5px"
,
justifyContent:
"center"
,
}}
>
{displayCourses}
</div>
</div>
</>
);
};
export
default
Courses;