summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/components/topologies/map/elements/RoomTile.js
blob: e7329dc050c73e0d74b3e30c065d243111693767 (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
import PropTypes from 'prop-types'
import React from 'react'
import { Rect } from 'react-konva'
import { Tile } from '../../../../shapes'
import { TILE_SIZE_IN_PIXELS } from '../MapConstants'

function RoomTile({ tile, color }) {
    return (
        <Rect
            x={tile.positionX * TILE_SIZE_IN_PIXELS}
            y={tile.positionY * TILE_SIZE_IN_PIXELS}
            width={TILE_SIZE_IN_PIXELS}
            height={TILE_SIZE_IN_PIXELS}
            fill={color}
        />
    )
}

RoomTile.propTypes = {
    tile: Tile,
    color: PropTypes.string,
}

export default RoomTile