apply suggestions
continuous-integration/drone/push Build is passing Details

pull/11/head
maxime.batista 1 year ago
parent c53a1b024c
commit a18014d4c3

@ -10,10 +10,8 @@ export interface BasketCourtProps {
} }
export function BasketCourt({players, onPlayerRemove}: BasketCourtProps) { export function BasketCourt({players, onPlayerRemove}: BasketCourtProps) {
const divRef = useRef<HTMLDivElement>(null);
return ( return (
<div id="court-container" ref={divRef} style={{position: "relative"}}> <div id="court-container" style={{position: "relative"}}>
<CourtSvg id="court-svg"/> <CourtSvg id="court-svg"/>
{players.map(player => { {players.map(player => {
return <CourtPlayer key={player.id} return <CourtPlayer key={player.id}

@ -15,19 +15,15 @@ export interface PlayerProps {
* */ * */
export default function CourtPlayer({player, onRemove}: PlayerProps) { export default function CourtPlayer({player, onRemove}: PlayerProps) {
const ref = useRef<HTMLDivElement>(null);
const x = player.rightRatio; const x = player.rightRatio;
const y = player.bottomRatio; const y = player.bottomRatio;
return ( return (
<Draggable <Draggable
handle={".player-piece"} handle={".player-piece"}
nodeRef={ref}
bounds="parent" bounds="parent"
> >
<div ref={ref} <div className={"player"}
className={"player"}
style={{ style={{
position: "absolute", position: "absolute",
left: `${x * 100}%`, left: `${x * 100}%`,

@ -1,4 +1,4 @@
import {CSSProperties, ReactElement, RefObject, useRef, useState} from "react"; import {CSSProperties, useRef, useState} from "react";
import "../style/editor.css"; import "../style/editor.css";
import TitleInput from "../components/TitleInput"; import TitleInput from "../components/TitleInput";
import {API} from "../Constants"; import {API} from "../Constants";

Loading…
Cancel
Save