11import React , { useState } from "react" ;
2- import { Container , ButtonGroup , ToggleButton } from "react-bootstrap" ;
32import SortingVisualizer from "../components/SortingVisualizer" ;
43import TraversalVisualizer from "../components/TraversalVisualizer" ;
54import { arraysInfo } from "../data/arraysInfo" ;
@@ -9,34 +8,28 @@ const VisualizersPage: React.FC = () => {
98 const [ selected , setSelected ] = useState < "sorting" | "graph" > ( "sorting" ) ; // declare the default state as string
109
1110 return (
12- < Container className = "mt-5" >
11+ < div className = "mt-5" >
1312 < h1 className = "text-center mb-4" > Algorithm Visualizers</ h1 >
1413
1514 { /* the selection options for sorting options */ }
16- < ButtonGroup className = "mb-4 d-flex justify-content-center" >
17- < ToggleButton
18- id = "sorting-toggle"
19- type = "radio"
20- variant = "outline-primary"
21- name = "visualizer"
22- value = "sorting"
23- checked = { selected === "sorting" }
24- onChange = { ( ) => setSelected ( "sorting" ) }
15+ < div className = "mb-4 d-flex justify-content-center" >
16+ < button
17+ className = { `rounded text-white px-4 py-2 ${
18+ selected === "sorting" ? "bg-blue-500" : "bg-gray-500"
19+ } `}
20+ onClick = { ( ) => setSelected ( "sorting" ) }
2521 >
2622 Sorting Visualizer
27- </ ToggleButton >
28- < ToggleButton
29- id = "graph-toggle"
30- type = "radio"
31- variant = "outline-secondary"
32- name = "visualizer"
33- value = "graph"
34- checked = { selected === "graph" }
35- onChange = { ( ) => setSelected ( "graph" ) }
23+ </ button >
24+ < button
25+ className = { `rounded text-white px-4 py-2 ${
26+ selected === "graph" ? "bg-blue-500" : "bg-gray-500"
27+ } `}
28+ onClick = { ( ) => setSelected ( "graph" ) }
3629 >
3730 Graph Visualizer
38- </ ToggleButton >
39- </ ButtonGroup >
31+ </ button >
32+ </ div >
4033
4134 { /* if the current state of our variable selected=sorting then we load the
4235 sorting component with its info, otherwise we will load the traversal
@@ -47,7 +40,7 @@ const VisualizersPage: React.FC = () => {
4740 ) : (
4841 < TraversalVisualizer graphsInfo = { graphsInfo } />
4942 ) }
50- </ Container >
43+ </ div >
5144 ) ;
5245} ;
5346
0 commit comments