File tree Expand file tree Collapse file tree
src/PathfindingVisualizer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ label {
7070 background-color : rgb (255 , 76 , 10 );
7171}
7272
73- @media (max-width : 1440 px ) {
73+ @media (max-width : 600 px ) {
7474 .button-container {
7575 display : flex;
7676 flex-direction : row;
@@ -87,7 +87,6 @@ label {
8787 border : 1px solid white;
8888 border-radius : 5px ;
8989 padding : 8px ;
90- float : left;
9190 }
9291
9392 button {
@@ -98,6 +97,42 @@ label {
9897 label {
9998 order : 3 ;
10099 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 ;
101136 }
102137}
103138
Original file line number Diff line number Diff line change @@ -41,6 +41,16 @@ export default class PathfindingVisualizer extends React.Component {
4141 this . setState ( { grid} ) ;
4242 calculateDimensions ( ) ;
4343 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+ }
4454 }
4555
4656 dimensionReset ( ) {
@@ -365,8 +375,8 @@ export default class PathfindingVisualizer extends React.Component {
365375 < button className = 'algo-buttons' disabled = { this . state . animationInProgress } onClick = { ( ) => this . dijkstra ( ) } > Dijkstra's algo</ button >
366376 < button className = 'algo-buttons' disabled = { this . state . animationInProgress } onClick = { ( ) => this . aStar ( ) } > A* Search</ button >
367377 < 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 >
370380 < button className = 'additional-buttons' disabled = { this . state . animationInProgress } onClick = { ( ) => this . createRandomGrid ( ) } > CREATE RANDOM GRID</ button >
371381 </ div >
372382
You can’t perform that action at this time.
0 commit comments