Skip to content

Commit da412b3

Browse files
committed
mainmenu minor fixes (still needs work)
1 parent 8576d21 commit da412b3

File tree

7 files changed

+23
-10
lines changed

7 files changed

+23
-10
lines changed

src/components/mainmenu/InsertSearchAlgorithms.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const baseUrl = window.location.origin;
77
const insertSearchAlgorithms = [
88
{ name: 'Binary Search Tree', url: `${baseUrl}/?alg=binarySearchTree&mode=search` },
99
{ name: '2-3-4 Tree', url: `${baseUrl}/?alg=TTFTree&mode=search` },
10+
{ name: 'AVL Tree', url: `${baseUrl}/?alg=AVLTree&mode=search` },
11+
1012
];
1113

1214
const InsertSearchAlgorithms = () => {
@@ -22,4 +24,4 @@ const InsertSearchAlgorithms = () => {
2224
);
2325
};
2426

25-
export default InsertSearchAlgorithms;
27+
export default InsertSearchAlgorithms;

src/components/mainmenu/StringSearchAlgorithms.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const stringSearchAlgorithms = [
1212
const StringSearchAlgorithms = () => {
1313
return (
1414
<div className="stringSearch-container">
15-
<h2 className="category">StringSearch</h2>
15+
<h2 className="category">String Search</h2>
1616
{stringSearchAlgorithms.map((algorithm, index) => (
1717
<a key={index} href={algorithm.url} className="stringSearch-link">
1818
{algorithm.name}
@@ -22,4 +22,4 @@ const StringSearchAlgorithms = () => {
2222
);
2323
};
2424

25-
export default StringSearchAlgorithms;
25+
export default StringSearchAlgorithms;

src/components/mainmenu/index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ import StringSearchAlgorithms from './StringSearchAlgorithms';
1111
// Get the base URL dynamically
1212
const baseUrl = window.location.origin;
1313

14+
// XXX should include category plus visibility flag so algorithms are
15+
// just listed in one place (here) and filtered appropriately rather
16+
// than have multiple algorithm lists (here plus SortingAlgorithms.js
17+
// plus InsertSearchAlgorithms.js etc), as was done previously...
18+
// XXX also fix display code (see XXX elsewhere)
1419
const allAlgorithms = [
1520
{ name: 'Brute Force', url: `${baseUrl}/?alg=bruteForceStringSearch&mode=search` },
1621
{ name: "Horspool's", url: `${baseUrl}/?alg=horspoolStringSearch&mode=search` },
@@ -25,6 +30,7 @@ const allAlgorithms = [
2530
{ name: "Warshall's (transitive closure)", url: `${baseUrl}/?alg=transitiveClosure&mode=tc` },
2631
{ name: 'Binary Search Tree', url: `${baseUrl}/?alg=binarySearchTree&mode=search` },
2732
{ name: '2-3-4 Tree', url: `${baseUrl}/?alg=TTFTree&mode=search` },
33+
{ name: 'AVL Tree', url: `${baseUrl}/?alg=AVLTree&mode=search` },
2834
{ name: 'Union Find', url: `${baseUrl}/?alg=unionFind&mode=find` },
2935
{ name: 'Heapsort', url: `${baseUrl}/?alg=heapSort&mode=sort` },
3036
{ name: 'Quicksort', url: `${baseUrl}/?alg=quickSort&mode=sort` },
@@ -68,13 +74,13 @@ const Mainmenu = () => {
6874
<div className="sidebar">
6975
<img src={logo} alt="Logo" className="logo" />
7076
<h1 className="title">
71-
<span className="algorithm">Algorithm</span>
77+
<span className="algorithm">Algorithms</span>
7278
<span className="in-action">In Action</span>
7379
</h1>
7480
<div className="search-container">
7581
<input
7682
type="text"
77-
placeholder="Search Algorithms"
83+
placeholder="Search for algorithm"
7884
value={searchTerm}
7985
onChange={handleSearch}
8086
className="search-bar"
@@ -106,4 +112,4 @@ const Mainmenu = () => {
106112
);
107113
};
108114

109-
export default Mainmenu;
115+
export default Mainmenu;

src/styles/GraphAlgorithms.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424

2525
.graph-link:hover {
2626
color: #2c3e50;
27-
}
27+
}

src/styles/SetAlgorithms.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424

2525
.set-link:hover {
2626
color: #2c3e50;
27-
}
27+
}

src/styles/StringSearchAlgorithms.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424

2525
.stringSearch-link:hover {
2626
color: #2c3e50;
27-
}
27+
}

src/styles/mainmenu.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
justify-content: space-between; // 这会将内容分散到顶部和底部
2020
}
2121

22+
// XXX Maybe should be .main-content??? - thats what is used in
23+
// src/components/mainmenu/index.js
24+
// Things are currently pretty awful for main menu formatting and if the
25+
// browser font size is larger than the default things just vanish off
26+
// the page, not to mention all the magic numbers in translating bits XXX
2227
.main-contents {
2328
width: 83.33%;
2429
height: 100vh;
@@ -116,4 +121,4 @@
116121
&:hover {
117122
color: #f0f0f0;
118123
}
119-
}
124+
}

0 commit comments

Comments
 (0)