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

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

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

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

export default TileGroup;