can assign ball to a player, player with ball is surrounded
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
7ab18786cc
commit
7177c07ca0
@ -1,13 +1,26 @@
|
||||
import React from "react";
|
||||
import React, {RefObject} from "react";
|
||||
|
||||
import "../../style/ball.css";
|
||||
|
||||
import Ball from "../../assets/icon/ball.svg?react";
|
||||
import Draggable from "react-draggable";
|
||||
|
||||
export function BallPiece() {
|
||||
export interface BallPieceProps {
|
||||
onDrop: () => void
|
||||
pieceRef: RefObject<HTMLDivElement>
|
||||
}
|
||||
|
||||
|
||||
export function BallPiece({onDrop, pieceRef}: BallPieceProps) {
|
||||
return (
|
||||
<div className={`ball-div`}>
|
||||
<Ball id={'ball'}/>
|
||||
</div>
|
||||
<Draggable
|
||||
onStop={onDrop}
|
||||
nodeRef={pieceRef}
|
||||
position={{x: 0, y: 0}}
|
||||
>
|
||||
<div className={`ball-div`} ref={pieceRef}>
|
||||
<Ball className={'ball'}/>
|
||||
</div>
|
||||
</Draggable>
|
||||
)
|
||||
}
|
@ -1,8 +1,10 @@
|
||||
#ball * {
|
||||
.ball * {
|
||||
fill: #c5520d;
|
||||
}
|
||||
|
||||
#ball {
|
||||
.ball {
|
||||
pointer-events: all;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
Loading…
Reference in new issue