summaryrefslogtreecommitdiff
path: root/src/components/map/groups/TileGroup.js
blob: 8fbdeb312d9c77ee78e959899fc6ed7287d6a0e5 (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
import PropTypes from "prop-types";
import React from "react";
import {Group} from "react-konva";
import Shapes from "../../../shapes/index";
import RoomTile from "../elements/RoomTile";
import RackGroup from "./RackGroup";

const TileGroup = ({tile, newTile, onClick}) => {
    let tileObject;
    switch (tile.objectType) {
        case "RACK":
            tileObject = <RackGroup tile={tile}/>;
            break;
        default:
            tileObject = null;
    }

    return (
        <Group
            onClick={() => onClick(tile)}
        >
            <RoomTile tile={tile} newTile={newTile}/>
            {tileObject}
        </Group>
    );
};

TileGroup.propTypes = {
    tile: Shapes.Tile,
    newTile: PropTypes.bool,
};

export default TileGroup;