forked from TamimEhsan/AlgorithmVisualizer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrid.jsx
More file actions
39 lines (37 loc) · 1.36 KB
/
Copy pathgrid.jsx
File metadata and controls
39 lines (37 loc) · 1.36 KB
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
34
35
36
37
38
39
import React, {Component} from 'react';
import Node from "./node";
import './grid.css';
class Grid extends Component {
state = {
grid: this.props.grid
}
render() {
return (
<div className="Grid">
{this.props.grid.map((row, rowidx) => {
return (
<div key={rowidx}>
{row.map((node, nodeidx) => {
const {row, col, isWall, visitedNode, } = node;
return (
<Node
key={nodeidx}
row={row}
col={col}
node={node}
isWall={isWall}
visitedNode={ visitedNode }
onMouseDown = {this.props.onMouseDown}
onMouseEnter = {this.props.onMouseEnter}
onMouseUp = {this.props.onMouseUp}
/>
);
})}
</div>
);
})}
</div>
);
}
}
export default Grid;