2016-06-16 11:34:13 +09:00
|
|
|
|
/*
|
2016-11-26 02:46:55 +08:00
|
|
|
|
The original Newsletter components is defined using an
|
2016-06-16 11:34:13 +09:00
|
|
|
|
ES6 class, so we use the "class foo extends bar" syntax
|
2016-11-26 02:46:55 +08:00
|
|
|
|
to extend it. This way, we can simply redefine the
|
2016-06-16 11:34:13 +09:00
|
|
|
|
render method to change it, while preserving
|
|
|
|
|
all of the class's other methods (other render
|
|
|
|
|
functions, event handlers, etc.).
|
|
|
|
|
*/
|
|
|
|
|
|
2016-12-18 19:04:11 +09:00
|
|
|
|
import { Components, getRawComponent, replaceComponent }from 'meteor/nova:core';
|
2016-06-16 11:34:13 +09:00
|
|
|
|
import React, { PropTypes, Component } from 'react';
|
2016-11-26 02:46:55 +08:00
|
|
|
|
import { FormattedMessage /*, intlShape */ } from 'react-intl';
|
2016-06-16 11:34:13 +09:00
|
|
|
|
|
2016-12-06 18:06:29 +01:00
|
|
|
|
class CustomNewsletter extends getRawComponent('Newsletter') {
|
2016-06-16 11:34:13 +09:00
|
|
|
|
|
|
|
|
|
render() {
|
2016-11-17 20:00:20 +01:00
|
|
|
|
// console.log(this.renderButton); <-- exists
|
2016-06-16 11:34:13 +09:00
|
|
|
|
|
2016-06-19 16:25:19 +09:00
|
|
|
|
return this.state.showBanner
|
|
|
|
|
? (
|
2016-06-16 11:34:13 +09:00
|
|
|
|
<div className="newsletter">
|
2016-06-19 16:25:19 +09:00
|
|
|
|
<h4 className="newsletter-tagline">✉️<FormattedMessage id="newsletter.subscribe_prompt"/>✉️</h4>
|
2016-11-17 20:00:20 +01:00
|
|
|
|
{this.props.currentUser ? this.renderButton() : this.renderForm()}
|
2016-12-06 18:06:29 +01:00
|
|
|
|
<a onClick={this.dismissBanner} className="newsletter-close"><Components.Icon name="close"/></a>
|
2016-06-16 11:34:13 +09:00
|
|
|
|
</div>
|
2016-06-19 16:25:19 +09:00
|
|
|
|
) : null;
|
2016-06-16 11:34:13 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-08 23:48:16 +01:00
|
|
|
|
replaceComponent('Newsletter', CustomNewsletter);
|