Skip to content

Commit 7ac7e0c

Browse files
authored
Add participants list and styling to activity cards
1 parent e0b767a commit 7ac7e0c

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/static/app.js

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

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

23+
const participantsList = details.participants.length > 0
24+
? `<ul class="participants-list">
25+
${details.participants.map(email => `<li>${email}</li>`).join('')}
26+
</ul>`
27+
: `<p class="no-participants">No participants yet. Be the first to sign up!</p>`;
28+
2329
activityCard.innerHTML = `
2430
<h4>${name}</h4>
2531
<p>${details.description}</p>
2632
<p><strong>Schedule:</strong> ${details.schedule}</p>
2733
<p><strong>Availability:</strong> ${spotsLeft} spots left</p>
34+
<div class="participants-section">
35+
<p class="participants-header"><strong>Participants:</strong></p>
36+
${participantsList}
37+
</div>
2838
`;
2939

3040
activitiesList.appendChild(activityCard);

src/static/styles.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,34 @@ section h3 {
7474
margin-bottom: 8px;
7575
}
7676

77+
.participants-section {
78+
margin-top: 15px;
79+
padding-top: 12px;
80+
border-top: 1px solid #e0e0e0;
81+
}
82+
83+
.participants-header {
84+
margin-bottom: 8px;
85+
color: #1a237e;
86+
}
87+
88+
.participants-list {
89+
list-style-type: disc;
90+
margin-left: 20px;
91+
color: #555;
92+
}
93+
94+
.participants-list li {
95+
margin-bottom: 5px;
96+
padding: 2px 0;
97+
}
98+
99+
.no-participants {
100+
font-style: italic;
101+
color: #999;
102+
margin: 0;
103+
}
104+
77105
.form-group {
78106
margin-bottom: 15px;
79107
}

0 commit comments

Comments
 (0)