summaryrefslogtreecommitdiff
path: root/src/components/map/elements
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/map/elements')
-rw-r--r--src/components/map/elements/HoverTile.js25
-rw-r--r--src/components/map/elements/RoomTile.js6
2 files changed, 28 insertions, 3 deletions
diff --git a/src/components/map/elements/HoverTile.js b/src/components/map/elements/HoverTile.js
new file mode 100644
index 00000000..a8bb2085
--- /dev/null
+++ b/src/components/map/elements/HoverTile.js
@@ -0,0 +1,25 @@
+import PropTypes from "prop-types";
+import React from "react";
+import {Rect} from "react-konva";
+import {ROOM_HOVER_INVALID_COLOR, ROOM_HOVER_VALID_COLOR} from "../../../colors/index";
+import {TILE_SIZE_IN_PIXELS} from "../MapConstants";
+
+const HoverTile = ({pixelX, pixelY, isValid, onClick}) => (
+ <Rect
+ x={pixelX}
+ y={pixelY}
+ width={TILE_SIZE_IN_PIXELS}
+ height={TILE_SIZE_IN_PIXELS}
+ fill={isValid ? ROOM_HOVER_VALID_COLOR : ROOM_HOVER_INVALID_COLOR}
+ onClick={onClick}
+ />
+);
+
+HoverTile.propTypes = {
+ pixelX: PropTypes.number.isRequired,
+ pixelY: PropTypes.number.isRequired,
+ isValid: PropTypes.bool.isRequired,
+ onClick: PropTypes.func.isRequired,
+};
+
+export default HoverTile;
diff --git a/src/components/map/elements/RoomTile.js b/src/components/map/elements/RoomTile.js
index 759dcf35..4d5e50fc 100644
--- a/src/components/map/elements/RoomTile.js
+++ b/src/components/map/elements/RoomTile.js
@@ -1,16 +1,16 @@
import React from "react";
import {Rect} from "react-konva";
-import {ROOM_DEFAULT_COLOR} from "../../../colors/index";
+import {ROOM_DEFAULT_COLOR, ROOM_IN_CONSTRUCTION_COLOR} from "../../../colors/index";
import Shapes from "../../../shapes/index";
import {TILE_SIZE_IN_PIXELS} from "../MapConstants";
-const RoomTile = ({tile}) => (
+const RoomTile = ({tile, newTile}) => (
<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={ROOM_DEFAULT_COLOR}
+ fill={newTile ? ROOM_IN_CONSTRUCTION_COLOR : ROOM_DEFAULT_COLOR}
/>
);