Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix responsiveness #59

Merged
merged 1 commit into from
Jan 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,7 @@ <h1 class='popUpTitle' id='popUpTitleLeaderboard'>LEADERBOARD</h1>
</div>
<div id="quiz-body">
<div class="quiz-question"></div>
<div class="quiz-answers">
<ul class="quiz-answers-list"></ul>
</div>
<ul class="quiz-answers-list"></ul>
</div>
</template>

Expand Down
4 changes: 4 additions & 0 deletions src/app/quizPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,14 @@ const updateQuestion = (questionElement, questionSet) => {
questionElement.classList.add(QUIZ_PAGE_STYLES.quizQuestionImageClass);
const imgElem = createImgElement(questionSet.question); // add img from url
questionElement.appendChild(imgElem);
const answers = document.querySelector('ul.quiz-answers-list');
answers.classList.add('answersTypeText')

} else if (CURRENT_MODE.questionType === "text") {
questionElement.classList.add(QUIZ_PAGE_STYLES.quizQuestionTextClass);
questionElement.innerText = questionSet.question; // add question as an inner text
const answers = document.querySelector('ul.quiz-answers-list');
answers.classList.add('answersTypeImage')
}
}

Expand Down
107 changes: 68 additions & 39 deletions styles/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ div.quiz-page {
background-size: cover;
}

div.quiz-top-bar {
.quiz-top-bar {
position: relative;
justify-self: center;
display: flex;
Expand Down Expand Up @@ -482,14 +482,13 @@ div.mode-title {
text-align: center;
}

div.question-image img {
.question-image img {
height: 90%;
margin: 0 auto;
display: block;

display: block;
}

div.question-text {
.question-text {
display: block;
width: 40%;
margin: 0 auto;
Expand All @@ -499,9 +498,10 @@ div.question-text {
font-size: 6.5vh;
background-color: var(--optionBlue);
color: var(--yellow);
padding: 1vh 0vh;
}

ul.quiz-answers-list {
.quiz-answers-list {
display: grid;
margin: 0 20vw;
grid-template-columns: 50% 50%;
Expand All @@ -510,7 +510,7 @@ ul.quiz-answers-list {
list-style: none;
}

li.quiz-answer .answer-image {
.answer-image {
display: flex;
justify-content: center;
border-radius: 4vh;
Expand All @@ -522,7 +522,7 @@ li.quiz-answer .answer-image {
}


li.quiz-answer .answer-text {
.answer-text {
text-align: center;
font-size: 3.5vh;
color: var(--yellow);
Expand All @@ -535,20 +535,20 @@ li.quiz-answer .answer-text {
transition: filter 0.1s ease-in-out;
}

li.quiz-answer div:hover {
.quiz-answer div:hover {
filter: brightness(1.2);
}

li.quiz-answer {
.quiz-answer {
width: 100%;
margin: 0 auto;
}

li.quiz-answer div {
.quiz-answer div {
cursor: pointer;
}

li.quiz-answer img {
.quiz-answer img {
max-height: 25vh;
}

Expand Down Expand Up @@ -632,6 +632,7 @@ li.quiz-answer img {
align-content: center;
align-items: space-around;
justify-content: space-around;
font-size: 2.6vh;
}

#popUpTitleResultsArea {
Expand Down Expand Up @@ -773,6 +774,60 @@ li.quiz-answer img {
#backToStartingPageButton {
padding: 1.2vh;
}

#quiz-body {
padding: 0px;
height: 100%;
}

.question-image {
margin: 0 auto 5vh;
}

.question-image img {
width: 60%;
height: auto;
}

.answersTypeText {
grid-template-columns: 1fr;
grid-template-rows: 1fr 1fr 1fr 1fr;
width: 95%;
margin: 0 auto;
}

.answersTypeImage {
grid-template-columns: 1fr 1fr;
grid-template-rows: auto;
width: 100%;
margin: 0;
padding-left: 3.5vh;
flex: 1 1 auto;
align-items: center;
align-content: space-around;
row-gap: 0
}

.answersTypeText.quiz-answer {
width: 95%;
margin: 0;
}

.answer-image {
width: 90%;
margin: 0;
}

.quiz-top-bar {
width: 90%;
}

.question-text {
width: 90%;
margin-bottom: 0;
margin: 0 auto ;
}

}

@media(orientation:portrait) {
Expand Down Expand Up @@ -801,36 +856,10 @@ li.quiz-answer img {

#startGame {
grid-row: 4;
margin: 1vh;
}

#pikachuImg {
justify-self: end;
}

/* quiz page */

/* div.quiz-top-bar{
width: 90vw;
font-size: 2.2vh;
} */

#quiz-body {
grid-template-rows: auto 30vh;
}

div.question-image img {
/* padding-top: 5vh; */
width: 60%;
height: auto;
}

ul.quiz-answers-list {
grid-template-columns: 100%;
grid-template-rows: 1fr 1fr 1fr 1fr;
}

li.quiz-answer img {
max-height: 15vh;
}

}