import * as Adapter from "enzyme-adapter-react-16";
import ContextMenu from "./context-menu";
import { ListItem } from "@material-ui/core";
-import { IconTypes } from "../icon/icon";
+import { ShareIcon } from "../icon/icon";
configure({ adapter: new Adapter() });
describe("<ContextMenu />", () => {
const items = [[{
- icon: IconTypes.ANNOUNCEMENT,
+ icon: ShareIcon,
name: "Action 1.1"
}, {
- icon: IconTypes.ANNOUNCEMENT,
+ icon: ShareIcon,
name: "Action 1.2"
},], [{
- icon: IconTypes.ANNOUNCEMENT,
+ icon: ShareIcon,
name: "Action 2.1"
}]];
import * as React from "react";
import { Popover, List, ListItem, ListItemIcon, ListItemText, Divider } from "@material-ui/core";
import { DefaultTransformOrigin } from "../popover/helpers";
-import IconBase, { IconTypes } from "../icon/icon";
+import { IconType } from "../icon/icon";
export interface ContextMenuItem {
name: string;
- icon: IconTypes;
+ icon: IconType;
}
export type ContextMenuItemGroup = ContextMenuItem[];
export default class ContextMenu extends React.PureComponent<ContextMenuProps> {
render() {
- const { anchorEl, items, onClose, onItemClick } = this.props;
+ const { anchorEl, items, onClose, onItemClick} = this.props;
return <Popover
anchorEl={anchorEl}
open={!!anchorEl}
key={actionIndex}
onClick={() => onItemClick(item)}>
<ListItemIcon>
- <IconBase icon={item.icon} />
+ <item.icon/>
</ListItemIcon>
<ListItemText>
{item.name}
import { ContextMenuActionSet } from "../context-menu-action-set";
import actions from "../../../store/project/project-action";
-import { IconTypes } from "../../../components/icon/icon";
+import { ShareIcon, NewProjectIcon } from "../../../components/icon/icon";
export const projectActionSet: ContextMenuActionSet = [[{
- icon: IconTypes.FOLDER,
+ icon: NewProjectIcon,
name: "New project",
execute: (dispatch, resource) => {
dispatch(actions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid }));
}
}, {
- icon: IconTypes.ANNOUNCEMENT,
+ icon: ShareIcon,
name: "Share",
execute: () => { return; }
}]];
\ No newline at end of file
import { ContextMenuActionSet } from "../context-menu-action-set";
import actions from "../../../store/project/project-action";
-import { IconTypes } from "../../../components/icon/icon";
+import { NewProjectIcon } from "../../../components/icon/icon";
export const rootProjectActionSet: ContextMenuActionSet = [[{
- icon: IconTypes.FOLDER,
+ icon: NewProjectIcon,
name: "New project",
execute: (dispatch, resource) => {
dispatch(actions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid }));