mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
implement gameboard v1
This commit is contained in:
parent
b103db681b
commit
0d7336edc2
177 changed files with 16995 additions and 139 deletions
|
|
@ -0,0 +1,48 @@
|
|||
import Divider from '@mui/material/Divider';
|
||||
import Menu from '@mui/material/Menu';
|
||||
import MenuItem from '@mui/material/MenuItem';
|
||||
|
||||
import './PlayerContextMenu.css';
|
||||
|
||||
export interface PlayerContextMenuProps {
|
||||
isOpen: boolean;
|
||||
anchorPosition: { top: number; left: number } | null;
|
||||
onClose: () => void;
|
||||
onRequestCreateToken: () => void;
|
||||
onRequestViewSideboard: () => void;
|
||||
}
|
||||
|
||||
function PlayerContextMenu({
|
||||
isOpen,
|
||||
anchorPosition,
|
||||
onClose,
|
||||
onRequestCreateToken,
|
||||
onRequestViewSideboard,
|
||||
}: PlayerContextMenuProps) {
|
||||
const handleCreateToken = () => {
|
||||
onRequestCreateToken();
|
||||
onClose();
|
||||
};
|
||||
|
||||
const handleViewSideboard = () => {
|
||||
onRequestViewSideboard();
|
||||
onClose();
|
||||
};
|
||||
|
||||
return (
|
||||
<Menu
|
||||
open={isOpen}
|
||||
onClose={onClose}
|
||||
anchorReference="anchorPosition"
|
||||
anchorPosition={anchorPosition ?? undefined}
|
||||
data-testid="player-context-menu"
|
||||
className="player-context-menu"
|
||||
>
|
||||
<MenuItem onClick={handleCreateToken}>Create token…</MenuItem>
|
||||
<Divider />
|
||||
<MenuItem onClick={handleViewSideboard}>View sideboard…</MenuItem>
|
||||
</Menu>
|
||||
);
|
||||
}
|
||||
|
||||
export default PlayerContextMenu;
|
||||
Loading…
Add table
Add a link
Reference in a new issue