Grégoire Delattre bcadc48d5a Launch prettier with the --fix option
They've changed their default settings, this changes a lot of stuff in
our code base.
2020-04-01 17:55:34 +02:00

36 lines
837 B
JavaScript

import React from "react";
import PropTypes from "prop-types";
import SweetAlert from "react-bootstrap-sweetalert";
import { connect } from "react-redux";
import { dismissAlert } from "../../actions/alerts";
const mapStateToProps = (state) => ({
show: state.alerts.get("show"),
title: state.alerts.get("message"),
type: state.alerts.get("type"),
});
const mapDispatchToProps = { dismissAlert };
const Alert = (props) => {
if (!props.show) {
return null;
}
return (
<SweetAlert
type={props.type}
title={props.title}
onConfirm={props.dismissAlert}
/>
);
};
Alert.propTypes = {
show: PropTypes.bool.isRequired,
title: PropTypes.string.isRequired,
dismissAlert: PropTypes.func.isRequired,
type: PropTypes.string,
};
export default connect(mapStateToProps, mapDispatchToProps)(Alert);