aboutsummaryrefslogtreecommitdiff
path: root/src/Toolkit.js
blob: 35d8759b5720ec504782e175817fc7d3a97444bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import React, { Component } from 'react'
import './fontawesome-all.min.js'

class ToolKitItem extends Component {
  render() {
    let iconClass = this.props.tool.icon + " fa-2x" 
    var divClass = "toolkititem"
    if (this.props.selected) {
      divClass += " selected"
    }
    return <div className={divClass}
        onClick={() => this.props.onSelectTool(this.props.tool)}>
        <i className={iconClass}></i>
      </div>
  }
}

export default class Toolkit extends Component {
  render() {
    let toolComponents = this.props.tools.map((tool) => {
      return <ToolKitItem 
        tool={tool} 
        key={tool.name}
        selected={tool === this.props.selectedTool}
        onSelectTool={this.props.onSelectTool}/>
    })
    return <div className="toolkit">
      {toolComponents}
    </div>
  }
}