2018-02-07 18:06:07 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React from 'react';
|
2016-09-07 23:00:52 +00:00
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import * as ToastActions from '../actions/toast';
|
|
|
|
|
2020-04-29 22:34:37 +00:00
|
|
|
import ExitIcon from '../../../images/exit.svg';
|
2017-02-22 19:29:35 +00:00
|
|
|
|
2016-09-07 23:00:52 +00:00
|
|
|
function Toast(props) {
|
|
|
|
return (
|
|
|
|
<section className="toast">
|
|
|
|
<p>
|
|
|
|
{props.text}
|
|
|
|
</p>
|
2020-05-05 23:03:58 +00:00
|
|
|
<button className="toast__close" onClick={props.hideToast} aria-label="Close Alert" >
|
|
|
|
<ExitIcon focusable="false" aria-hidden="true" />
|
2016-09-07 23:00:52 +00:00
|
|
|
</button>
|
|
|
|
</section>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Toast.propTypes = {
|
|
|
|
text: PropTypes.string.isRequired,
|
|
|
|
hideToast: PropTypes.func.isRequired
|
|
|
|
};
|
|
|
|
|
|
|
|
function mapStateToProps(state) {
|
|
|
|
return state.toast;
|
|
|
|
}
|
|
|
|
|
|
|
|
function mapDispatchToProps(dispatch) {
|
|
|
|
return bindActionCreators(ToastActions, dispatch);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Toast);
|