e7abb55ee7
* Update to react, react-dom 16.2.0 * Update react-redux * Update react-tabs * Update redux-devtools * Update redux-devtools-dock-monitor * Update redux-devtools-log-monitor * Add prop-types package * Update gitignore * Update all files to use prop-types package * Update react-router * Update react-inlinesvg
36 lines
904 B
JavaScript
36 lines
904 B
JavaScript
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
import { bindActionCreators } from 'redux';
|
|
import { connect } from 'react-redux';
|
|
import InlineSVG from 'react-inlinesvg';
|
|
import * as ToastActions from '../actions/toast';
|
|
|
|
const exitUrl = require('../../../images/exit.svg');
|
|
|
|
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);
|