aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/components/presentational
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-06-26 21:46:41 +0200
committerNoah Loomans <noahloomans@gmail.com>2018-06-26 21:46:41 +0200
commit315adeb5e2012b7f7bcfcd1478f9d6dd2cc1092d (patch)
tree17ecdc44866845b679ca69337041856df3cab33c /src/client/react/components/presentational
parentd95009ed42a3a94c947bccbed8a436cbf6b9306c (diff)
Update code to comply with new styling
Diffstat (limited to 'src/client/react/components/presentational')
-rw-r--r--src/client/react/components/presentational/IconFromUserType.js7
-rw-r--r--src/client/react/components/presentational/Result.js18
-rw-r--r--src/client/react/components/presentational/Schedule.js5
3 files changed, 16 insertions, 14 deletions
diff --git a/src/client/react/components/presentational/IconFromUserType.js b/src/client/react/components/presentational/IconFromUserType.js
index 3a7350c..0cb5154 100644
--- a/src/client/react/components/presentational/IconFromUserType.js
+++ b/src/client/react/components/presentational/IconFromUserType.js
@@ -37,7 +37,8 @@ class IconFromUserType extends React.Component {
};
render() {
- switch (this.props.userType) {
+ const { userType, defaultIcon } = this.props;
+ switch (userType) {
case 'c':
return <ClassIcon />;
case 't':
@@ -47,8 +48,8 @@ class IconFromUserType extends React.Component {
case 'r':
return <RoomIcon />;
default:
- if (this.props.defaultIcon) {
- return this.props.defaultIcon;
+ if (defaultIcon) {
+ return defaultIcon;
}
throw new Error('`userType` was invalid or not given, but `defaultIcon` is not defined.');
diff --git a/src/client/react/components/presentational/Result.js b/src/client/react/components/presentational/Result.js
index 900d3ac..d80554c 100644
--- a/src/client/react/components/presentational/Result.js
+++ b/src/client/react/components/presentational/Result.js
@@ -35,25 +35,25 @@ class Result extends React.Component {
};
render() {
+ const { onClick, isSelected, userId } = this.props;
+
return (
/* eslint-disable jsx-a11y/click-events-have-key-events */
/* eslint-disable jsx-a11y/no-static-element-interactions */
<div
- className={classnames('Result', {
- isSelected: this.props.isSelected,
- })}
- onClick={this.props.onClick}
+ className={classnames('Result', { isSelected })}
+ onClick={onClick}
>
<div className="iconWrapper">
- <IconFromUserType userType={users.byId[this.props.userId].type} />
+ <IconFromUserType userType={users.byId[userId].type} />
</div>
<div className="text">
- {users.byId[this.props.userId].value}
- {users.byId[this.props.userId].alt &&
+ {users.byId[userId].value}
+ {users.byId[userId].alt && (
<span className="alt">
- {` ${users.byId[this.props.userId].alt}`}
+ {` ${users.byId[userId].alt}`}
</span>
- }
+ )}
</div>
</div>
);
diff --git a/src/client/react/components/presentational/Schedule.js b/src/client/react/components/presentational/Schedule.js
index 7823238..727a1f4 100644
--- a/src/client/react/components/presentational/Schedule.js
+++ b/src/client/react/components/presentational/Schedule.js
@@ -66,9 +66,10 @@ class Schedule extends React.Component {
}
render() {
- const DOMPurify = createDOMPurify(window);
+ const { htmlStr } = this.props;
- const cleanHTML = DOMPurify.sanitize(this.props.htmlStr, {
+ const DOMPurify = createDOMPurify(window);
+ const cleanHTML = DOMPurify.sanitize(htmlStr, {
ADD_ATTR: ['rules'],
});