-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphNode.js
More file actions
33 lines (28 loc) · 828 Bytes
/
GraphNode.js
File metadata and controls
33 lines (28 loc) · 828 Bytes
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 React, {Component} from "react";
export default class GraphNode extends Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
const {
col,
isFinish,
isStart,
isWall,
onMouseDown,
onMouseEnter,
onMouseUp,
row,
} = this.props;
const extraClassName = isFinish ? 'node-finish' : isStart ? 'node-start' : isWall ? 'node-wall' : '';
return (
<div
id={`node-${row}-${col}`}
className={`node ${extraClassName}`}
onMouseDown={() => onMouseDown(row, col)}
onMouseEnter={() => onMouseEnter(row, col)}
onMouseUp={() => onMouseUp()}></div>
);
}
}