forked from TamimEhsan/AlgorithmVisualizer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrect.jsx
More file actions
43 lines (38 loc) · 1016 Bytes
/
Copy pathrect.jsx
File metadata and controls
43 lines (38 loc) · 1016 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
34
35
36
37
38
39
40
41
42
43
import React, {Component} from 'react';
import './style.css';
class Rect extends Component {
render() {
return (
<div
className='rect'
style={{height:this.props.rect.width,
border: this.checkBorder(),
background:this.checkColor(),
margin:this.props.marg
}}
>
</div>
);
}
checkColor = () => {
if( this.props.rect.isSorted ){
return "green";
} else if( this.props.rect.isSorting ){
return "orange";
} else if( this.props.rect.isLeft ){
return "red";
} else if(this.props.rect.isRight){
return "purple";
}else{
return "#ADD8E6";
}
}
checkBorder = () =>{
if( this.props.rect.isRange ){
return "0px solid black";
} else{
return "0px"
}
}
}
export default Rect;