import Remarkable from 'remarkable';

const markdown = (text) => {
  var md = new Remarkable();
  return {
    __html: md.render(text)
  };
};


const Event = ({ title, start_time, end_time, content, eventClickHandler, index, active }) => {
  const classes = (index === active) ? 'cal-event-content-active' : '';

  return (
    <div onClick={ () => { eventClickHandler(index); } } className="cal-event" id={`event-${index}`}>
      <div className="cal-event-indicator"></div>

      <div className="cal-event-header">
        <p className="cal-event-date">{start_time.toTimeString().substr(0, 5)}</p>
        <h3 className="cal-event-title">{title}</h3>
      </div>

      <p className={`cal-event-content ${ classes }`} dangerouslySetInnerHTML={markdown(content)}/>
      <p className={`cal-event-content ${ classes } cal-event-endtime`}>Antatt sluttidspunkt: {end_time.toTimeString().substr(0, 5)}</p>
    </div>
  );
};

export default Event;

@@ -330,56 +330,8 @@
 %3Cdiv
- onClick=%7B () =%3E %7B eventClickHandler(index); %7D %7D
  cla
@@ -425,32 +425,80 @@
 div%3E%0A%0A      %3Cdiv
+ onClick=%7B () =%3E %7B eventClickHandler(index); %7D %7D
  className=%22cal-

Fix bug: clicking on links inside events not working