2016-09-08 01:00:52 +02:00
|
|
|
import React, { PropTypes } from 'react';
|
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import InlineSVG from 'react-inlinesvg';
|
|
|
|
import * as ToastActions from '../actions/toast';
|
|
|
|
|
2017-02-22 20:29:35 +01:00
|
|
|
const exitUrl = require('../../../images/exit.svg');
|
|
|
|
|
2016-09-08 01:00:52 +02:00
|
|
|
function Toast(props) {
|
|
|
|
return (
|
|
|
|
<section className="toast">
|
|
|
|
<p>
|
|
|
|
{props.text}
|
|
|
|
</p>
|
|
|
|
<button className="toast__close" onClick={props.hideToast}>
|
|
|
|
<InlineSVG src={exitUrl} alt="Close Keyboard Shortcuts Overlay" />
|
|
|
|
</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);
|