import React, { Component } from 'react'; import { Popover, List, ListItem, ListButton, Link, Icon, Actions, ActionsGroup, ActionsButton } from 'framework7-react'; import { f7 } from 'framework7-react'; import { useTranslation } from 'react-i18next'; const idContextMenuElement = "idx-context-menu-popover"; class ContextMenuView extends Component { constructor(props) { super(props); } componentDidMount() { // f7.popover.open('#idx-context-menu-popover', '#idx-context-menu-target'); } render() { const buttons = this.props.items || {}; return ( this.props.onMenuClosed()} > {buttons.length && buttons.map((b, index) => !b.icon ? this.props.onMenuItemClick(b.event)} /> : this.props.onMenuItemClick(b.event)}> )} ) } } const ActionsWithExtraItems = ({items, onMenuItemClick, opened, onActionClosed}) => { const { t } = useTranslation(); const _t = t('ContextMenu', {returnObjects: true}); return ( onActionClosed()}> {items.length > 0 && items.map((item, index)=>{ return( {onMenuItemClick(item.event)}}>{item.caption} ) })} {_t.menuCancel} ) }; const exportedIdMenuElemen = `#${idContextMenuElement}`; export {ContextMenuView as default, exportedIdMenuElemen as idContextMenuElement, ActionsWithExtraItems};