aboutsummaryrefslogtreecommitdiff
path: root/src/client/react
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-01-28 19:59:09 +0100
committerNoah Loomans <noahloomans@gmail.com>2018-01-28 19:59:09 +0100
commitdde583c2fa9b990e1d30f7292f9cf28d9310e570 (patch)
tree49572aa6ffac87c081146d003741044821f84c5e /src/client/react
parent9e539c650b40ea76f9c7d00d9b28b33905d1b1d6 (diff)
Move Schedule and Loading to seperate files
Diffstat (limited to 'src/client/react')
-rw-r--r--src/client/react/components/container/View.js21
-rw-r--r--src/client/react/components/presentational/Loading.js5
-rw-r--r--src/client/react/components/presentational/Schedule.js22
3 files changed, 29 insertions, 19 deletions
diff --git a/src/client/react/components/container/View.js b/src/client/react/components/container/View.js
index 7ac5d3e..4f16100 100644
--- a/src/client/react/components/container/View.js
+++ b/src/client/react/components/container/View.js
@@ -1,30 +1,13 @@
import React from 'react';
import PropTypes from 'prop-types';
-import createDOMPurify from 'dompurify';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import { fetchSchedule } from '../../actions/view';
import extractSchedule from '../../lib/extractSchedule';
-const Loading = () => <div>Loading...</div>;
-
-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,
-};
+import Schedule from '../presentational/Schedule';
+import Loading from '../presentational/Loading';
const View = ({
schedules,
diff --git a/src/client/react/components/presentational/Loading.js b/src/client/react/components/presentational/Loading.js
new file mode 100644
index 0000000..84eaac7
--- /dev/null
+++ b/src/client/react/components/presentational/Loading.js
@@ -0,0 +1,5 @@
+import React from 'react';
+
+const Loading = () => <div>Loading...</div>;
+
+export default Loading;
diff --git a/src/client/react/components/presentational/Schedule.js b/src/client/react/components/presentational/Schedule.js
new file mode 100644
index 0000000..256c1b4
--- /dev/null
+++ b/src/client/react/components/presentational/Schedule.js
@@ -0,0 +1,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;