Skip to content

Commit 8fa086c

Browse files
committed
search button
added search button in assessments and made the assesments distribute in easy tough medium
1 parent 174ffcf commit 8fa086c

File tree

5 files changed

+91
-5
lines changed

5 files changed

+91
-5
lines changed

jobsdoor360-website/src/main/ejs/main-files/test/index.ejs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99
<%- include('../../partials/navbar.ejs') %>
1010
<section class="content">
1111
<h1 class="center">Master Your Skills: Assessments & Challenges</h1>
12+
<div class="search-container">
13+
<input
14+
type="text"
15+
id="search-input"
16+
class="search-box"
17+
placeholder="Search Assessments..."
18+
/>
19+
<button id="search-button" class="btn-search">Search</button>
20+
</div>
1221
<div class="assessment-grid" id="assessment">
1322
Fetching Assessments ...!
1423
</div>

myaccount/index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
content="Unlock Your Career Potential with JobsDoor360: Expert Development Programs & Job Opportunities. Learn Full Stack, Java, and Web Development. Advance Your Career with Industry Professionals. Gain In-Demand Skills for Software Jobs. Practice Interviews and Perfect Your CV. Join Now for a Spring Demo!"
1111
/>
1212
<link rel="stylesheet" href="/staticfiles/mainfiles/myaccount/style.css" />
13-
13+
<link
14+
href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"
15+
rel="stylesheet"
16+
/>
1417
<meta charset="utf-8" />
1518
<meta name="viewport" content="width=device-width, initial-scale=1" />
1619
<meta name="google-adsense-account" content="ca-pub-2075086355753452" />

staticfiles/mainfiles/test/script.js

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
import {
2+
getFirestore,
3+
collection,
4+
getDocs,
5+
getDoc,
6+
query,
7+
where,
8+
doc,
9+
writeBatch,
10+
setDoc,
11+
addDoc,
12+
updateDoc,
13+
orderBy // <-- Add this
14+
} from "https://www.gstatic.com/firebasejs/10.1.0/firebase-firestore.js";
15+
16+
17+
118
let userId = null;
219
let userData = {};
320

@@ -11,7 +28,8 @@ onAuthStateChanged(auth, (user) => {
1128
async function fetchAssessments() {
1229
try {
1330
console.log(`Fetching assessments`);
14-
let querySnapshot = await getDocs(collection(db, "assessment"));
31+
const assessmentsQuery = query(collection(db, "assessment"), orderBy("title", "asc"));
32+
let querySnapshot = await getDocs(assessmentsQuery);
1533
console.log(`Assessments found`);
1634
displayCards(querySnapshot);
1735
} catch (error) {
@@ -37,6 +55,24 @@ function displayCards(assessments) {
3755
`);
3856
});
3957
divCont.innerHTML = content.join('');
58+
59+
setupSearch();
60+
}
61+
62+
63+
64+
function setupSearch() {
65+
const searchInput = document.getElementById("search-input");
66+
const assessmentBoxes = Array.from(document.getElementsByClassName("assessment-box"));
67+
68+
searchInput.addEventListener("input", () => {
69+
const searchValue = searchInput.value.toLowerCase();
70+
assessmentBoxes.forEach(box => {
71+
const title = box.querySelector(".assessment-title").textContent.toLowerCase();
72+
box.style.display = title.includes(searchValue) ? "flex" : "none";
73+
});
74+
});
4075
}
4176

42-
fetchAssessments();
77+
// Initial fetch of assessments
78+
fetchAssessments();

staticfiles/mainfiles/test/style.css

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ body.no-scroll {
3535
grid-template-columns: repeat(4, 1fr); /* Updated to 4 columns */
3636
gap: 20px; /* Reduced gap between cards */
3737
margin-bottom: 20px;
38+
3839
}
3940

4041
.assessment-box {
@@ -56,7 +57,7 @@ body.no-scroll {
5657
}
5758

5859
.assessment-title {
59-
font-size: 2rem; /* Adjusted font size */
60+
font-size: 1.5rem; /* Adjusted font size */
6061
color: #343a40;
6162
margin-bottom: 10px;
6263
text-align: center;
@@ -73,6 +74,7 @@ body.no-scroll {
7374
text-decoration: none;
7475
text-align: center;
7576
margin-top: auto; /* Align button at the bottom */
77+
7678
}
7779

7880
.btn-start:hover {
@@ -116,4 +118,31 @@ body.no-scroll {
116118
padding: 8px 16px;
117119
font-size: 0.8rem;
118120
}
119-
}
121+
}
122+
123+
.search-container {
124+
text-align: center;
125+
margin: 20px 0;
126+
}
127+
128+
.search-box {
129+
padding: 10px;
130+
width: 60%;
131+
font-size: 16px;
132+
border: 1px solid #ccc;
133+
border-radius: 4px;
134+
}
135+
136+
.btn-search {
137+
padding: 10px 20px;
138+
font-size: 16px;
139+
background-color: #007BFF;
140+
color: white;
141+
border: none;
142+
border-radius: 4px;
143+
cursor: pointer;
144+
}
145+
146+
.btn-search:hover {
147+
background-color: #0056b3;
148+
}

test/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,15 @@
151151
<!-- End Google Tag Manager (noscript) -->
152152
<section class="content">
153153
<h1 class="center">Master Your Skills: Assessments & Challenges</h1>
154+
<div class="search-container">
155+
<input
156+
type="text"
157+
id="search-input"
158+
class="search-box"
159+
placeholder="Search Assessments..."
160+
/>
161+
<button id="search-button" class="btn-search">Search</button>
162+
</div>
154163
<div class="assessment-grid" id="assessment">
155164
Fetching Assessments ...!
156165
</div>

0 commit comments

Comments
 (0)