diff --git a/JS/records.js b/JS/records.js index 6aaf5d7..d001db3 100644 --- a/JS/records.js +++ b/JS/records.js @@ -17,16 +17,15 @@ document.addEventListener('DOMContentLoaded', async function () { if (response.ok) { const users = await response.json(); preloaderContainer.style.display = 'none'; + const userCardTemplate = document.getElementById('user_card_template'); users.forEach(user => { - const userCard = document.createElement('div'); - userCard.classList.add('user_card'); - userCard.innerHTML = ` -
Nickname: ${user.nickname}
-Date: ${user.date}
-Wellbeing: ${user.wellBeing}
-Bench Press: ${user.benchPress} кг
-Squat: ${user.squat} кг
-Deadlift: ${user.deadlift} кг
`; + const userCard = document.importNode(userCardTemplate.content, true); + userCard.querySelector('.user_info.nickname').textContent = 'Nickname: ${user.nickname}'; + userCard.querySelector('.user_info.date').textContent = 'Date of the record: ${user.date}'; + userCard.querySelector('.user_info.wellbeing').textContent = 'Wellbeing: ${user.wellbeing}'; + userCard.querySelector('.user_info.benchpress').textContent = 'Bench Press: ${user.benchpress} kg'; + userCard.querySelector('.user_info.squat').textContent = 'Squat: ${user.squat} kg'; + userCard.querySelector('.user_info.deadlift').textContent = 'Deadlift: ${user.deadlift} kg'; userCardsContainer.appendChild(userCard); }); } else { diff --git a/index.html b/index.html index 0bf845c..e960762 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - +