Skip to content

Commit

Permalink
feat: make context menu works
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Jan 13, 2022
1 parent 1ddb33d commit ab7dbbd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions quake_webapp/quake-board/src/QuakeBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import createEngine, {DagreEngine, DefaultNodeModel, DiagramModel} from '@projec
import {Item, Menu, Separator, Submenu, useContextMenu} from "react-contexify";
import {CanvasWidget} from "@projectstorm/react-canvas-core";
import styled from "styled-components";
import 'react-contexify/dist/ReactContexify.css';

export type Props = {}

Expand Down Expand Up @@ -74,11 +75,8 @@ function QuakeBoard(props: Props) {
);

return (
<>
<StyledDiv onDoubleClick={handleContextMenu}>
<StyledCanvasWidget engine={engine} />

<div onContextMenu={handleContextMenu} />

<Menu id={MENU_ID}>
<Item onClick={handleItemClick}>Item 1</Item>
<Item onClick={handleItemClick}>Item 2</Item>
Expand All @@ -90,12 +88,17 @@ function QuakeBoard(props: Props) {
<Item onClick={handleItemClick}>Sub Item 2</Item>
</Submenu>
</Menu>
</>
</StyledDiv>
);
}

export default QuakeBoard;

const StyledDiv = styled.div`
width: 100%;
height: 100%;
`

const StyledCanvasWidget = styled(CanvasWidget)`
background: #333333;
width: 100%;
Expand Down

0 comments on commit ab7dbbd

Please sign in to comment.