Use proper variables

This commit is contained in:
Justin Edmund 2020-10-19 05:12:50 -07:00
parent ee0c677d83
commit f8172bd157

View file

@ -11,6 +11,8 @@ export enum GridType {
} }
interface Props { interface Props {
userId?: string
grid: GridArray<Character>
editable: boolean editable: boolean
exists: boolean exists: boolean
onSelect: (type: GridType, character: Character, position: number) => void onSelect: (type: GridType, character: Character, position: number) => void
@ -19,8 +21,9 @@ interface Props {
const CharacterGrid = (props: Props) => { const CharacterGrid = (props: Props) => {
const numCharacters: number = 5 const numCharacters: number = 5
const [characters, setCharacters] = useState<GridArray<Character>>({}) function receiveCharacter(character: Character, position: number) {
const [partyId, setPartyId] = useState('') props.onSelect(GridType.Character, character, position)
}
return ( return (
<div className="CharacterGrid"> <div className="CharacterGrid">
@ -31,9 +34,9 @@ const CharacterGrid = (props: Props) => {
<li key={`grid_unit_${i}`} > <li key={`grid_unit_${i}`} >
<CharacterUnit <CharacterUnit
editable={props.editable} editable={props.editable}
onReceiveData={() => {}} onReceiveData={receiveCharacter}
position={i} position={i}
character={characters[i]} character={props.grid[i]}
/> />
</li> </li>
) )