import React from "react";
import PropTypes from "prop-types";
import { defineMessages, injectIntl } from "react-intl";
import Menu from "@material-ui/core/Menu";
import MenuItem from "@material-ui/core/MenuItem";
import { Divider } from "@material-ui/core";
import Icon from "/imports/ui/components/icon/component";
import Button from "/imports/ui/components/button/component";
import { ENTER, SPACE } from "/imports/utils/keyCodes";
import { styles } from "./styles";
const intlMessages = defineMessages({
close: {
id: 'app.dropdown.close',
description: 'Close button label',
},
});
//Used to switch to mobile view
const MAX_WIDTH = 640;
class BBBMenu extends React.Component {
constructor(props) {
super(props);
this.state = {
anchorEl: null,
};
this.opts = props.opts;
this.autoFocus = false;
this.handleClick = this.handleClick.bind(this);
this.handleClose = this.handleClose.bind(this);
}
handleClick(event) {
this.setState({ anchorEl: event.currentTarget });
};
handleClose(event) {
const { onCloseCallback } = this.props;
this.setState({ anchorEl: null }, onCloseCallback());
if (event) {
event.persist();
if (event.type === 'click') {
setTimeout(() => {
document.activeElement.blur();
}, 0);
}
}
};
makeMenuItems() {
const { actions, selectedEmoji } = this.props;
return actions?.map(a => {
const { dataTest, label, onClick, key, disabled } = a;
const itemClasses = [styles.menuitem, a?.className];
if (key?.toLowerCase()?.includes(selectedEmoji?.toLowerCase())) itemClasses.push(styles.emojiSelected);
return [
a.dividerTop &&