blob: f208401741e969940221c7126eb35075d9a5b4bc (
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
32
33
34
35
36
|
import PropTypes from 'prop-types'
import React from 'react'
import { Group } from 'react-konva'
import { Tile } from '../../../../shapes'
import { ROOM_DEFAULT_COLOR, ROOM_IN_CONSTRUCTION_COLOR } from '../../../../util/colors'
import RoomTile from '../elements/RoomTile'
import RackContainer from '../RackContainer'
function TileGroup({ tile, newTile, onClick }) {
let tileObject
if (tile.rack) {
tileObject = <RackContainer tile={tile} />
} else {
tileObject = null
}
let color = ROOM_DEFAULT_COLOR
if (newTile) {
color = ROOM_IN_CONSTRUCTION_COLOR
}
return (
<Group onClick={() => onClick(tile)}>
<RoomTile tile={tile} color={color} />
{tileObject}
</Group>
)
}
TileGroup.propTypes = {
tile: Tile,
newTile: PropTypes.bool,
onClick: PropTypes.func,
}
export default TileGroup
|