Basic loop

This commit is contained in:
Melvin Valster
2019-07-12 09:58:15 +02:00
parent 426f6c14fd
commit 85f9208b4a
15 changed files with 767 additions and 64 deletions
+33
View File
@@ -0,0 +1,33 @@
import React from 'react'
import { List } from 'immutable'
import { TalentSlot } from './TalentSlot';
interface Props {
tree: TalentTree
spentPoints: List<number>
onTalentPress: TalentClickHandler
}
export const TalentTree: React.FC<Props> = ({ tree, spentPoints, onTalentPress }) => {
const { talents } = tree
const handleTalentPress = (index) => {
return (e) => {
onTalentPress(index, 'add')
}
}
return (
<div className="tree">
<h2>{tree.name}</h2>
{talents.map((talent, index) =>
<TalentSlot
key={index}
talent={talent}
points={spentPoints.get(index, 0)}
onClick={handleTalentPress(index)}
/>
)}
</div>
)
}