Skip to content

Commit c6e8d07

Browse files
Added Footer and Color Meanings
1 parent 078a44b commit c6e8d07

File tree

8 files changed

+131
-2
lines changed

8 files changed

+131
-2
lines changed

src/App.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import Chart from "./components/Chart/Chart";
44
import Button from "./components/Button/Button";
55
import Navbar from "./components/Navbar/Navbar";
66
import Description from "./components/Description/Description";
7+
import ColorMeanings from "./components/ColorMeanings/ColorMeanings";
8+
import Footer from "./components/Footer/Footer";
79
import { useEffect } from "react";
810

911
import generateArray from "./helpers/generateArray";
@@ -109,8 +111,10 @@ function App() {
109111
isDisabled={isSorting}
110112
className="sort"
111113
/>
114+
<ColorMeanings />
112115
<Description algType={algType} />
113116
</div>
117+
<Footer />
114118
</div>
115119
);
116120
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.color-meanings {
2+
/* background-color: pink; */
3+
width: 80%;
4+
margin: 5% auto;
5+
min-height: 3rem;
6+
display: grid;
7+
grid-template-columns: repeat(4, 1fr);
8+
grid-gap: 25px;
9+
}
10+
11+
.color-meanings div {
12+
/* background-color: red; */
13+
padding: 5%;
14+
display: flex;
15+
align-items: center;
16+
}
17+
18+
.color-meanings div span {
19+
display: block;
20+
margin-right: 5%;
21+
width: 30px;
22+
height: 30px;
23+
}
24+
25+
@media (max-width: 1000px) {
26+
.color-meanings {
27+
grid-template-columns: repeat(3, 1fr);
28+
}
29+
}
30+
31+
@media (max-width: 800px) {
32+
.color-meanings {
33+
grid-template-columns: repeat(2, 1fr);
34+
}
35+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import "./ColorMeanings.css";
2+
3+
const ColorMeanings = () => {
4+
return (
5+
<div className="color-meanings">
6+
<div>
7+
<span style={{ backgroundColor: "gray" }}></span>
8+
<p>Unsorted</p>
9+
</div>
10+
<div>
11+
<span style={{ backgroundColor: "red" }}></span>
12+
<p>Comparing</p>
13+
</div>
14+
<div>
15+
<span style={{ backgroundColor: "yellow" }}></span>
16+
<p>Swapping</p>
17+
</div>
18+
<div>
19+
<span style={{ backgroundColor: "orange" }}></span>
20+
<p>Overwriting from Memory</p>
21+
</div>
22+
<div>
23+
<span style={{ backgroundColor: "green" }}></span>
24+
<p>Sorted</p>
25+
</div>
26+
</div>
27+
);
28+
};
29+
30+
export default ColorMeanings;

src/components/Footer/Footer.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.footer {
2+
box-sizing: border-box;
3+
padding: 0;
4+
margin: 0;
5+
width: 100%;
6+
text-align: left;
7+
height: 4rem;
8+
margin-top: 2%;
9+
border-top: 1px solid rgb(214, 214, 214);
10+
padding-top: 1%;
11+
padding-left: 3%;
12+
}
13+
14+
.footer h1 {
15+
font-weight: 400;
16+
font-size: 1.5rem;
17+
}
18+
19+
.footer b {
20+
font-family: "Times New Roman", Times, serif;
21+
}

src/components/Footer/Footer.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import "./Footer.css";
2+
3+
const Footer = () => {
4+
return (
5+
<div className="footer">
6+
<h1>
7+
Built by <b>Sasank Tadepalli</b>
8+
</h1>
9+
</div>
10+
);
11+
};
12+
13+
export default Footer;

src/helpers/bubbleSort.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,29 @@ const bubbleSort = (alterStateAfterTimeOut, data) => {
66
alterStateAfterTimeOut(array, j, j + 1, count, j === 0, array.length - i);
77
count++;
88
if (array[j] > array[j + 1]) {
9+
alterStateAfterTimeOut(
10+
array,
11+
j,
12+
j + 1,
13+
count,
14+
j === 0,
15+
array.length - i,
16+
"yellow"
17+
);
18+
count++;
919
let temp = array[j];
1020
array[j] = array[j + 1];
1121
array[j + 1] = temp;
22+
alterStateAfterTimeOut(
23+
array,
24+
j,
25+
j + 1,
26+
count,
27+
j === 0,
28+
array.length - i,
29+
"yellow"
30+
);
31+
count++;
1232
// console.log(arr);
1333
}
1434
}

src/helpers/insertionSort.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ const insertionSort = (alterStateAfterTimeOut, data) => {
55
let key = array[i];
66
let j = i - 1;
77
while (j >= 0 && array[j] > key) {
8-
alterStateAfterTimeOut(array, i, j, count);
8+
alterStateAfterTimeOut(array, j + 1, j, count, false, 0, "yellow");
99
count++;
1010
array[j + 1] = array[j];
1111
j--;
12+
alterStateAfterTimeOut(array, j + 1, j, count, false, 0, "yellow");
13+
count++;
1214
}
1315
array[j + 1] = key;
14-
alterStateAfterTimeOut(array, -1, j + 1, count, false, -1, "yellow");
16+
alterStateAfterTimeOut(array, -1, j + 1, count, false, -1, "orange");
1517
count++;
1618
}
1719
for (let i = 0; i < array.length; i++) {

src/helpers/selectionSort.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ const selectionSort = (alterStateAfterTimeOut, data) => {
1111
// console.log(arr);
1212
}
1313
}
14+
alterStateAfterTimeOut(array, i, index, count, false, 0, "yellow");
15+
count++;
1416
let temp = array[i];
1517
array[i] = array[index];
1618
array[index] = temp;
19+
alterStateAfterTimeOut(array, i, index, count, false, 0, "yellow");
20+
count++;
1721
}
1822
alterStateAfterTimeOut(
1923
array,

0 commit comments

Comments
 (0)