File tree 2 files changed +49
-4
lines changed
src/PathfindingVisualizer
2 files changed +49
-4
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ label {
70
70
background-color : rgb (255 , 76 , 10 );
71
71
}
72
72
73
- @media (max-width : 1440 px ) {
73
+ @media (max-width : 600 px ) {
74
74
.button-container {
75
75
display : flex;
76
76
flex-direction : row;
@@ -87,7 +87,6 @@ label {
87
87
border : 1px solid white;
88
88
border-radius : 5px ;
89
89
padding : 8px ;
90
- float : left;
91
90
}
92
91
93
92
button {
@@ -98,6 +97,42 @@ label {
98
97
label {
99
98
order : 3 ;
100
99
width : 30.5% ;
100
+ font-size : 15px ;
101
+ }
102
+ }
103
+
104
+ @media (min-width : 601px ) and (max-width : 1439px ) {
105
+ .button-container {
106
+ display : flex;
107
+ flex-direction : row;
108
+ flex-wrap : wrap;
109
+ align-items : center;
110
+ justify-content : space-evenly;
111
+ text-align : center;
112
+ padding : 8px ;
113
+ }
114
+
115
+ # bar-title {
116
+ width : 80% ;
117
+ order : 1 ;
118
+ border : 1px solid white;
119
+ border-radius : 5px ;
120
+ padding : 8px ;
121
+ letter-spacing : 2px ;
122
+ }
123
+
124
+ button {
125
+ width : 20% ;
126
+ order : 2 ;
127
+ font-size : 14px ;
128
+ }
129
+
130
+ label {
131
+ order : 3 ;
132
+ width : 50% ;
133
+ padding-top : 5px ;
134
+ padding-bottom : 20px ;
135
+ font-size : 17px ;
101
136
}
102
137
}
103
138
Original file line number Diff line number Diff line change @@ -41,6 +41,16 @@ export default class PathfindingVisualizer extends React.Component {
41
41
this . setState ( { grid} ) ;
42
42
calculateDimensions ( ) ;
43
43
this . dimensionReset ( ) ; // remove previous paths
44
+
45
+ // change text of BFS and DFS buttons depending on the width
46
+ if ( window . innerWidth >= 740 && window . innerWidth < 1440 ) {
47
+ document . getElementById ( 'bfs-button' ) . innerText = 'Breadth-first search' ;
48
+ document . getElementById ( 'dfs-button' ) . innerText = 'Depth-first search' ;
49
+ }
50
+ else {
51
+ document . getElementById ( 'bfs-button' ) . innerText = 'BFS' ;
52
+ document . getElementById ( 'dfs-button' ) . innerText = 'DFS' ;
53
+ }
44
54
}
45
55
46
56
dimensionReset ( ) {
@@ -365,8 +375,8 @@ export default class PathfindingVisualizer extends React.Component {
365
375
< button className = 'algo-buttons' disabled = { this . state . animationInProgress } onClick = { ( ) => this . dijkstra ( ) } > Dijkstra's algo</ button >
366
376
< button className = 'algo-buttons' disabled = { this . state . animationInProgress } onClick = { ( ) => this . aStar ( ) } > A* Search</ button >
367
377
< button className = 'algo-buttons' disabled = { this . state . animationInProgress } onClick = { ( ) => this . bidirectionalSearch ( ) } > Bidirectional Search</ button >
368
- < button className = 'algo-buttons' disabled = { this . state . animationInProgress } onClick = { ( ) => this . bfs ( ) } > BFS</ button >
369
- < button className = 'algo-buttons' disabled = { this . state . animationInProgress } onClick = { ( ) => this . dfs ( ) } > DFS</ button >
378
+ < button className = 'algo-buttons' id = 'bfs-button' disabled = { this . state . animationInProgress } onClick = { ( ) => this . bfs ( ) } > BFS</ button >
379
+ < button className = 'algo-buttons' id = 'dfs-button' disabled = { this . state . animationInProgress } onClick = { ( ) => this . dfs ( ) } > DFS</ button >
370
380
< button className = 'additional-buttons' disabled = { this . state . animationInProgress } onClick = { ( ) => this . createRandomGrid ( ) } > CREATE RANDOM GRID</ button >
371
381
</ div >
372
382
You can’t perform that action at this time.
0 commit comments