Skip to content

Commit f84650c

Browse files
committed
Add participant list display and styling to activities
1 parent ba167e1 commit f84650c

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/static/app.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,19 @@ document.addEventListener("DOMContentLoaded", () => {
2020

2121
const spotsLeft = details.max_participants - details.participants.length;
2222

23+
const participantsList = details.participants.length
24+
? `<ul>${details.participants.map(participant => `<li>${participant}</li>`).join("")}</ul>`
25+
: "<p>No participants yet.</p>";
26+
2327
activityCard.innerHTML = `
2428
<h4>${name}</h4>
2529
<p>${details.description}</p>
2630
<p><strong>Schedule:</strong> ${details.schedule}</p>
2731
<p><strong>Availability:</strong> ${spotsLeft} spots left</p>
32+
<div class="participants">
33+
<h5>Participants:</h5>
34+
${participantsList}
35+
</div>
2836
`;
2937

3038
activitiesList.appendChild(activityCard);

src/static/styles.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,29 @@ button:hover {
136136
display: none;
137137
}
138138

139+
.participants {
140+
margin-top: 15px;
141+
padding: 10px;
142+
border-top: 1px solid #ddd;
143+
background-color: #f1f8e9;
144+
border-radius: 5px;
145+
}
146+
147+
.participants h5 {
148+
margin-bottom: 10px;
149+
color: #2e7d32;
150+
}
151+
152+
.participants ul {
153+
list-style-type: disc;
154+
padding-left: 20px;
155+
}
156+
157+
.participants li {
158+
margin-bottom: 5px;
159+
color: #333;
160+
}
161+
139162
footer {
140163
text-align: center;
141164
margin-top: 30px;

0 commit comments

Comments
 (0)