|
|
@@ -0,0 +1,40 @@
|
|
|
+import { connect } from 'react-redux';
|
|
|
+import React from 'react';
|
|
|
+import PropTypes from 'prop-types';
|
|
|
+import classNames from 'classnames';
|
|
|
+
|
|
|
+import { annoyed } from 'actions/annoy';
|
|
|
+
|
|
|
+import './style.scss';
|
|
|
+
|
|
|
+const mapStateToProps = state => ({
|
|
|
+ loading: state.annoy.loading,
|
|
|
+ error: state.annoy.error
|
|
|
+});
|
|
|
+
|
|
|
+const mapDispatchToProps = dispatch => ({
|
|
|
+ onAnnoy: () => dispatch(annoyed())
|
|
|
+});
|
|
|
+
|
|
|
+function AnnoyButton({ loading, error, onAnnoy }) {
|
|
|
+ return (
|
|
|
+ <div className={classNames('annoy-button-wrapper', {
|
|
|
+ loading,
|
|
|
+ error
|
|
|
+ })}>
|
|
|
+ <button className="button-annoy"
|
|
|
+ onClick={onAnnoy}
|
|
|
+ disabled={loading}
|
|
|
+ >{'Annoy'}</button>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+}
|
|
|
+
|
|
|
+AnnoyButton.propTypes = {
|
|
|
+ loading: PropTypes.bool.isRequired,
|
|
|
+ error: PropTypes.bool.isRequired,
|
|
|
+ onAnnoy: PropTypes.func.isRequired
|
|
|
+};
|
|
|
+
|
|
|
+export default connect(mapStateToProps, mapDispatchToProps)(AnnoyButton);
|
|
|
+
|