Refactor in_app_announcement component to class

[MAILPOET-1525]
This commit is contained in:
Rostislav Wolny
2018-09-18 13:49:22 +02:00
parent 9b50163b10
commit ed2ebeee52

View File

@@ -1,26 +1,29 @@
import React from 'react'; import React from 'react';
import InAppAnnouncementDot from './in_app_announcement_dot.jsx'; import InAppAnnouncementDot from './in_app_announcement_dot.jsx';
const InAppAnnouncement = (props) => { class InAppAnnouncement extends React.Component {
if (props.newUser !== null && render() {
window.mailpoet_is_new_user !== props.newUser if (this.props.newUser !== null &&
) { window.mailpoet_is_new_user !== this.props.newUser
return null; ) {
} return null;
}
if (props.validUntil < (new Date().getTime() / 1000)) { if (this.props.validUntil < (new Date().getTime() / 1000)) {
return null; return null;
} }
return ( return (
<InAppAnnouncementDot <InAppAnnouncementDot
className={props.className} className={this.props.className}
width={props.width} width={this.props.width}
height={props.height} height={this.props.height}
> >
{props.children} {this.props.children}
</InAppAnnouncementDot>); </InAppAnnouncementDot>
}; );
}
}
InAppAnnouncement.propTypes = { InAppAnnouncement.propTypes = {
width: React.PropTypes.string, width: React.PropTypes.string,