Commit f75fd259 authored by Zac Wood's avatar Zac Wood

Fixed unexpected behavior when clicking on read only sections

parent 257bea38
......@@ -10,6 +10,9 @@ export default class Section extends React.Component {
onClick = e => {
e.stopPropagation();
if (this.props.readOnly) return;
console.log(e.target.tagName);
if (e.target.tagName === 'A') return; // if we clicked on a link, don't add the section to the cart
......@@ -20,20 +23,38 @@ export default class Section extends React.Component {
};
render() {
const { name, title, crn, readOnly, instructor_name, instructor_url, teaching_rating, location, days, start_time, end_time } = this.props;
const {
name,
title,
crn,
readOnly,
instructor_name,
instructor_url,
teaching_rating,
location,
days,
start_time,
end_time,
} = this.props;
const { inCart } = this.state;
const percent = teaching_rating ? <Stars percent={(teaching_rating[0] / 5) * 100} /> : null;
const percent = teaching_rating ? (
<Stars percent={(teaching_rating[0] / 5) * 100} />
) : null;
const remove = (
<span className="float-right text-center add-remove-btn" style={inCart ? {} : { display: 'none' }}>
<span
className="float-right text-center add-remove-btn"
style={inCart ? {} : { display: 'none' }}>
<i id="icon" className="fas fa-minus" />
<br />
<span className="text">Remove</span>
</span>
);
const add = (
<span className="float-right text-center add-remove-btn" style={inCart ? { display: 'none' } : {}}>
<span
className="float-right text-center add-remove-btn"
style={inCart ? { display: 'none' } : {}}>
<i id="icon" className="fas fa-plus" />
<br />
<span className="text">Add</span>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment