// Copyright (C) The Arvados Authors. All rights reserved. // // SPDX-License-Identifier: AGPL-3.0 import * as React from "react"; import { connect } from "react-redux"; import { RootState } from "../../store/store"; import MaterialSnackbar, { SnackbarProps } from "@material-ui/core/Snackbar"; import { Dispatch } from "redux"; import { snackbarActions } from "../../store/snackbar/snackbar-actions"; const mapStateToProps = (state: RootState): SnackbarProps => ({ anchorOrigin: { vertical: "bottom", horizontal: "left" }, open: state.snackbar.open, message: {state.snackbar.message}, autoHideDuration: state.snackbar.hideDuration }); const mapDispatchToProps = (dispatch: Dispatch): Pick => ({ onClose: () => { dispatch(snackbarActions.CLOSE_SNACKBAR()); } }); export const Snackbar = connect(mapStateToProps, mapDispatchToProps)(MaterialSnackbar);