Skip to content

Commit 8591837

Browse files
committed
moving to more tailwind
1 parent 3d172dc commit 8591837

File tree

6 files changed

+17
-61
lines changed

6 files changed

+17
-61
lines changed

src/components/GraphLegend.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
11
// Graph legend component. Only imported in traversal visualiser
22
const GraphLegend = () => {
33
return (
4-
<div className="legend mb-4 text-center">
4+
<div className="max-w-6xl mx-auto p-8 px-2">
55
<ul className="flex flex-wrap justify-center mb-0">
66
<li className="mr-4 mb-2">
77
<span className="bg-blue-500 w-4 h-4 inline-block mr-2"></span>
8-
<span className="text-gray-700">Start</span>
8+
<span>Start</span>
99
</li>
1010
<li className="mr-4 mb-2">
1111
<span className="bg-green-500 w-4 h-4 inline-block mr-2"></span>
12-
<span className="text-gray-700">Objective</span>
12+
<span>Objective</span>
1313
</li>
1414
<li className="mr-4 mb-2">
1515
<span className="bg-yellow-500 w-4 h-4 inline-block mr-2"></span>
16-
<span className="text-gray-700">Path</span>
16+
<span>Path</span>
1717
</li>
1818
<li className="mr-4 mb-2">
1919
<span className="bg-gray-500 w-4 h-4 inline-block mr-2"></span>
20-
<span className="text-gray-700">Obstacle</span>
20+
<span>Obstacle</span>
2121
</li>
2222
<li className="mr-4 mb-2">
23-
<span className="bg-teal-500 w-4 h-4 inline-block mr-2"></span>
24-
<span className="text-gray-700">Expanded Nodes</span>
23+
<span className="bg-teal-300 w-4 h-4 inline-block mr-2"></span>
24+
<span>Expanded Nodes</span>
2525
</li>
2626
<li className="mr-4 mb-2">
2727
<span className="bg-red-500 w-4 h-4 inline-block mr-2"></span>
28-
<span className="text-gray-700">
29-
Weighted (ignored for bfs and dfs)
30-
</span>
28+
<span>Weighted (ignored for bfs and dfs)</span>
3129
</li>
3230
</ul>
3331
</div>

src/components/Navigation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Link } from "react-router-dom";
33
// simple navbar component to be usedon all pages
44
const Navigation = () => {
55
return (
6-
<div className="border-b border-gray-300">
6+
<div className="border-b border-gray-300 m-2">
77
<div className="flex p-2 mx-auto space-x-4">
88
<Link
99
to="/"

src/components/SortingVisualizer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ const SortingVisualizer: React.FC<ArrayProps> = ({ arraysInfo }) => {
5959
// the sorting visualizer component
6060
return (
6161
<div className="">
62-
<div className="array-container">
62+
<div className="flex flex-wrap justify-center items-end h-full w-full">
6363
{array.map((value, idx) => (
6464
<div
6565
key={idx}
66-
className="array-bar"
66+
className="array-bar mr-1"
6767
style={{ height: `${value}px` }}
6868
></div>
6969
))}

src/components/TraversalVisualizer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ const TraversalVisualizer: React.FC<GraphProps> = ({ graphsInfo }) => {
122122

123123
// the traversal visualizer component
124124
return (
125-
<div className=" ">
125+
<div className=" mx-auto ">
126126
<div className="">
127127
{matrix.map((row, rowIndex) => (
128-
<div key={rowIndex} className={"matrix-row matrix-row-" + rowIndex}>
128+
<div key={rowIndex} className={"flex matrix-row-" + rowIndex}>
129129
{row.map((cell, colIndex) => (
130130
<div
131131
key={colIndex}

src/css/Arrays.css

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
.array-bar {
22
background-color: red;
3-
width: 20px;
3+
width: 10px;
44
transition: height 0.2s ease-in-out;
55
}
6-
7-
.array-container {
8-
display: flex;
9-
justify-content: center;
10-
align-items: flex-end;
11-
flex-wrap: wrap;
12-
gap: 2px;
13-
}

src/css/Graphs.css

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,22 @@
1-
.matrix-row {
2-
display: flex;
3-
}
4-
51
.matrix-cell {
6-
border: 1px solid black;
7-
height: 15px;
82
width: 15px;
9-
padding: 0px;
10-
margin: 0px;
11-
}
12-
13-
.legend {
14-
align-content: center;
15-
display: flex;
16-
justify-content: center;
17-
}
18-
19-
.legend ul {
20-
list-style: none;
21-
}
22-
23-
.legend li {
24-
display: inline;
25-
margin: 10px;
26-
padding: 10px;
27-
}
28-
29-
.matrix-cell {
30-
width: 30px;
31-
height: 30px;
3+
height: 15px;
324
margin: 1px;
33-
line-height: 30px;
34-
font-size: 0.75rem;
5+
font-size: 0;
356
background-color: #e9ecef;
36-
transition: background-color 0.3s;
7+
transition: background-color 0.5s;
378
}
389

3910
.start {
4011
background-color: #0d6efd !important;
41-
color: white;
4212
}
4313

4414
.objective {
4515
background-color: #198754 !important;
46-
color: white;
4716
}
4817

4918
.obstacle {
5019
background-color: #6c757d !important;
51-
color: white;
5220
}
5321

5422
.path {
@@ -57,10 +25,8 @@
5725

5826
.weight {
5927
background-color: red !important;
60-
color: white;
6128
}
6229

6330
.expanded {
6431
background-color: aquamarine !important;
65-
/* color: white; */
6632
}

0 commit comments

Comments
 (0)