Skip to content

Commit 277b827

Browse files
committed
updating frontend
1 parent fb198a7 commit 277b827

File tree

5 files changed

+37
-33
lines changed

5 files changed

+37
-33
lines changed

src/App.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
import "./css/App.css";
21
import NavBar from "./components/Navigation";
32
import { Routes, Route } from "react-router-dom";
43
import VisualizersPage from "./pages/Visualiser";
4+
import "./css/index.css";
55

66
function App() {
77
return (
88
<>
99
<NavBar />
10-
<main className="main-content">
11-
<Routes>
12-
<Route path="/" element={<VisualizersPage />} />
13-
</Routes>
14-
</main>
10+
<Routes>
11+
<Route path="/" element={<VisualizersPage />} />
12+
</Routes>
1513
</>
1614
);
1715
}

src/components/Navigation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const Navigation = () => {
77
<div className="flex p-2 mx-auto space-x-4">
88
<Link
99
to="/"
10-
className="py-2 text-white text-lg font-bold text-decoration-none"
10+
className="py-2 text-white text-lg font-bold text-decoration-none hover:bg-gray-300 rounded"
1111
>
1212
Algorithm Visualiser
1313
</Link>

src/css/App.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/css/index.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
11
@import "tailwindcss";
2+
3+
@layer base {
4+
html {
5+
@apply text-white;
6+
}
7+
}
8+
9+
@theme {
10+
--color-secondary-300: oklch(98.5% 0.001 106.423);
11+
--color-primary-600: oklch(55.2% 0.016 285.938);
12+
}
13+
14+
body {
15+
background-color: oklch(12.9% 0.042 264.695);
16+
font-family: "Roboto", sans-serif;
17+
}

src/pages/Visualiser.tsx

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, { useState } from "react";
2-
import { Container, ButtonGroup, ToggleButton } from "react-bootstrap";
32
import SortingVisualizer from "../components/SortingVisualizer";
43
import TraversalVisualizer from "../components/TraversalVisualizer";
54
import { 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

Comments
 (0)