aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/components/presentational/Schedule.js
blob: 256c1b4a00b9f598178f3b952434723be629b396 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import React from 'react';
import PropTypes from 'prop-types';
import createDOMPurify from 'dompurify';

const Schedule = ({ htmlStr }) => {
  const DOMPurify = createDOMPurify(window);

  const cleanHTML = DOMPurify.sanitize(htmlStr, {
    ADD_ATTR: ['rules'],
  });

  return (
    // eslint-disable-next-line react/no-danger
    <div dangerouslySetInnerHTML={{ __html: cleanHTML }} />
  );
};

Schedule.propTypes = {
  htmlStr: PropTypes.string.isRequired,
};

export default Schedule;