Skip to content

Commit

Permalink
Add data-identifier on homescreen and quizscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
neves-gabriel committed Nov 23, 2021
1 parent 3d0226a commit 4416ee9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ <h1 onclick="reloadPage()">BuzzQuizz</h1>

<div class="list-title-container hidden">
<h2>Seus Quizzes</h2>
<button name="create-new-quiz" onclick="openQuizCreation()"><ion-icon name="add-circle"></ion-icon></button>
<button name="create-new-quiz" onclick="openQuizCreation()" data-identifier="create-quizz"><ion-icon name="add-circle"></ion-icon></button>
</div>

<ul class="quiz-list user">
<ul class="quiz-list user" data-identifier="user-quizzes">
<div class="empty-list">
<p>Você não criou nenhum quizz ainda :(</p>
<button name="create-first-new-quiz" onclick="openQuizCreation()">Criar quizz</button>
<button name="create-first-new-quiz" onclick="openQuizCreation()" data-identifier="create-quizz">Criar quizz</button>
</div>
</ul>

<h2>Todos os Quizzes</h2>

<ul class="quiz-list all">
<ul class="quiz-list all" data-identifier="general-quizzes">
</ul>

</div>
Expand Down
12 changes: 6 additions & 6 deletions js/homescreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ function renderQuizzPreview (response) {
for(let i=0; i< allQuizzes.length; i++){
if (userQuizzes.includes(allQuizzes[i].id)) {
userQuizContainer.innerHTML += `<li class="quiz-preview" style="background-image: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(0, 0, 0, 0.5) 64.58%, #000000 100%), url(${allQuizzes[i].image});"
onclick="openQuiz(${allQuizzes[i].id})">
onclick="openQuiz(${allQuizzes[i].id})" data-identifier="quizz-card">
<p>${allQuizzes[i].title}</p>
</li>`;
} else {
quizContainer.innerHTML += `<li class="quiz-preview" style="background-image: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(0, 0, 0, 0.5) 64.58%, #000000 100%), url(${allQuizzes[i].image});"
onclick="openQuiz(${allQuizzes[i].id})">
onclick="openQuiz(${allQuizzes[i].id})" data-identifier="quizz-card">
<p>${allQuizzes[i].title}</p>
</li>`;
}
}
} else {
for(let i=0; i< allQuizzes.length; i++){
quizContainer.innerHTML += `<li class="quiz-preview" style="background-image: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(0, 0, 0, 0.5) 64.58%, #000000 100%), url(${allQuizzes[i].image});"
onclick="openQuiz(${allQuizzes[i].id})">
onclick="openQuiz(${allQuizzes[i].id})" data-identifier="quizz-card">
<p>${allQuizzes[i].title}</p>
</li>`;
}
Expand Down Expand Up @@ -103,7 +103,7 @@ function renderQuestion(questionData){
let answersList = [];
let returnHtml = ``;

returnHtml += ` <div class="question">
returnHtml += ` <div class="question" data-identifier="question">
<div class="question-title" style="background-color: ${questionData.color}">
${questionData.title}
</div>
Expand All @@ -123,7 +123,7 @@ function renderAnswers(answersList){
let answersHtml = ``;

for(let currentAnswer of answersList){
answersHtml +=`<li class="answer ${currentAnswer.isCorrectAnswer}" onclick="selectAnswer(this)">
answersHtml +=`<li class="answer ${currentAnswer.isCorrectAnswer}" onclick="selectAnswer(this)" data-identifier="answer">
<img class="answer-img" src="${currentAnswer.image}"/>
<div class="answer-title">${currentAnswer.text}</div>
</li>`;
Expand Down Expand Up @@ -189,7 +189,7 @@ function finishQuiz(){
function buildResult(){
let level = calculateLevel();

return `<div class="result-text">${level.title}</div>
return `<div class="result-text" data-identifier="quizz-result">${level.title}</div>
<div class="result-details">
<img class="result-img" src="${level.image}"/>
<div class="result-comment">${level.text}</div>
Expand Down

0 comments on commit 4416ee9

Please sign in to comment.