Vulcan/packages/example-customization/lib/components/CustomNewsletter.jsx
2017-05-19 14:42:43 -06:00

31 lines
1 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
The original Newsletter components is defined using an
ES6 class, so we use the "class foo extends bar" syntax
to extend it. This way, we can simply redefine the
render method to change it, while preserving
all of the class's other methods (other render
functions, event handlers, etc.).
*/
import { Components, getRawComponent, replaceComponent }from 'meteor/vulcan:core';
import React from 'react';
import { FormattedMessage /*, intlShape */ } from 'react-intl';
class CustomNewsletter extends getRawComponent('Newsletter') {
render() {
// console.log(this.renderButton); <-- exists
return this.state.showBanner
? (
<div className="newsletter">
<h4 className="newsletter-tagline"><FormattedMessage id="newsletter.subscribe_prompt"/></h4>
{this.props.currentUser ? this.renderButton() : this.renderForm()}
<a onClick={this.dismissBanner} className="newsletter-close"><Components.Icon name="close"/></a>
</div>
) : null;
}
}
replaceComponent('Newsletter', CustomNewsletter);