const _excluded = ["children"];
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
import React from "react";
import { useDispatch, useSelector } from "react-redux";
import { makeStyles } from "@mui/styles";
import PropTypes from "prop-types";
import useTranslation from "../../../utils/useTranslation";
import MapButton from "../../MapButton";
import { ReactComponent as MenuOpen } from "../../../img/sbb/040_hamburgermenu_102_36.svg";
import { ReactComponent as MenuClosed } from "../../../img/sbb/040_schliessen_104_36.svg";
import { setDisplayMenu } from "../../../model/app/actions";
const useStyles = makeStyles({
  displayMenuToggler: {
    padding: "8px"
  }
});
function MenuToggler(_ref) {
  let {
      children
    } = _ref,
    props = _objectWithoutProperties(_ref, _excluded);
  const classes = useStyles();
  const {
    t
  } = useTranslation();
  const displayMenu = useSelector(state => state.app.displayMenu);
  const dispatch = useDispatch();
  return /*#__PURE__*/React.createElement(MapButton, _extends({
    className: "wkp-display-menu-toggler ".concat(classes.displayMenuToggler),
    onClick: () => dispatch(setDisplayMenu(!displayMenu)),
    title: displayMenu ? t("Schliessen") : t("Menü"),
    "data-testid": "map-controls-menu-toggler"
  }, props), children !== null && children !== void 0 ? children : displayMenu ? /*#__PURE__*/React.createElement(MenuClosed, null) : /*#__PURE__*/React.createElement(MenuOpen, null));
}
MenuToggler.propTypes = {
  children: PropTypes.node
};
export default MenuToggler;
//# sourceMappingURL=MenuToggler.js.map