Skip to content

Commit

Permalink
Fix Minefield text with image question type
Browse files Browse the repository at this point in the history
  • Loading branch information
cs1m0n committed Oct 16, 2024
1 parent 105d890 commit fbc636a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions src/Experience/Games/MineField.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default class MineField {
setHTMLForQuestion(index) {
const question = instance.data[index]
const questionContent =
question.type === 'text'
question.type === 'text' || question.type === 'text_image'
? `<p>${question.question_text}</p>`
: `<div id="task-image"><img src="${question.question_image}" alt="Question Image" /></div>`

Expand All @@ -107,10 +107,13 @@ export default class MineField {
question.answers.forEach((answer, index) => {
const bulletIcon = `url('games/minefield/${colors[index % colors.length]}')`

answersHTML +=
question.type === 'text' || question.type === 'text_with_image'
? `<div class=""><div class="bg-cover" style="background-image: ${bulletIcon};"></div> <p> ${answer.answer_text}<p></div>`
: `<img src="${answer.answer_image}" alt="Answer Image" />`
if (question.type === 'text') {
answersHTML += `<div><div class="bg-cover" style="background-image: ${bulletIcon};"></div> <p>${answer.answer_text}<p></div>`
} else if (question.type === 'image') {
answersHTML += `<img src="${answer.answer_image}" alt="Answer Image" />`
} else if (question.type === 'text_image') {
answersHTML += `<div><div class="bg-cover" style="background-image: ${bulletIcon};"></div><img src="${answer.answer_image}" alt="Answer Image" /></div>`
}
})

const questionHTML = `
Expand Down
4 changes: 2 additions & 2 deletions src/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4536,7 +4536,7 @@ img.lazyloaded ~ div.img-loader {

.right {
width: 35%;
height: 50vh;
height: 61.5vh;
}

.finish-line {
Expand Down Expand Up @@ -4656,7 +4656,7 @@ img.lazyloaded ~ div.img-loader {

img {
width: 96px;
height: 96px;
height: auto;
display: inline-block;
}
}
Expand Down

0 comments on commit fbc636a

Please sign in to comment.