-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MNG-16 Add a help screen, style it (has to be polished, the scrollbar…
… is not… (#16) * Add a help screen, style it (has to be polished, the scrollbar is not styled). Add help screen HTML the the page, add an event listener for the help screen and a reusable function showAPopUpScreen (can be used to display hall of fame) * Remove event listener from the exit button every time it is clicked, correct spelling mistakes
- Loading branch information
1 parent
53f8e96
commit e5d2ea6
Showing
5 changed files
with
143 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
import { doc } from "prettier"; | ||
import { showStartingPage } from './showStartingPage.js' | ||
import { showStartingPage } from './showStartingPage.js'; | ||
import { showAPopUpScreen } from './showAPopUpScreen'; | ||
import { addHelpScreenTemplate } from "./addHelpScreenTemplate.js"; | ||
|
||
export const App = ({options}) => { | ||
|
||
showStartingPage(); | ||
addHelpScreenTemplate(); | ||
|
||
//add event listener to the help button | ||
document.querySelector('#helpOption').addEventListener('click', () => { | ||
showAPopUpScreen(document.querySelector('#helpScreen')) | ||
}); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export const addHelpScreenTemplate = () => { | ||
const appScreen = document.querySelector('#pokequiz-app'); | ||
const helpScreenTemplate = | ||
`<div class='popUpScreen' id='helpScreen'> | ||
<div class='popUpTitleArea'> | ||
<h1 class='popUpTitle'>HELP</h1> | ||
<p class='exitPopUpScreen'>✕</p> | ||
</div> | ||
<ul class='mainHelpTextSection'> | ||
<li><span class='helpTitle'>Who's that pokemon?</span> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum lacinia, arcu vel accumsan rhoncus, sapien dolor commodo purus, gravida rhoncus massa leo eu quam. Etiam pulvinar bibendum gravida. Aliquam eu augue arcu. Sed lacus dui, tempus sed libero non, posuere mattis ex. Suspendisse dictum metus et laoreet ultricies. Praesent ac pharetra risus. Maecenas risus diam, eleifend non dolor id, tristique facilisis urna.</li> | ||
<li><span class='helpTitle'>What it looks like?</span> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum lacinia, arcu vel accumsan rhoncus, sapien dolor commodo purus, gravida rhoncus massa leo eu quam. Etiam pulvinar bibendum gravida. Aliquam eu augue arcu. Sed lacus dui, tempus sed libero non, posuere mattis ex. Suspendisse dictum metus et laoreet ultricies. Praesent ac pharetra risus. Maecenas risus diam, eleifend non dolor id, tristique facilisis urna.</li> | ||
<li><span class='helpTitle'>Guess the type!</span> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum lacinia, arcu vel accumsan rhoncus, sapien dolor commodo purus, gravida rhoncus massa leo eu quam. Etiam pulvinar bibendum gravida. Aliquam eu augue arcu. Sed lacus dui, tempus sed libero non, posuere mattis ex. Suspendisse dictum metus et laoreet ultricies. Praesent ac pharetra risus. Maecenas risus diam, eleifend non dolor id, tristique facilisis urna.</li> | ||
</ul> | ||
<div class='popUpImgArea'> | ||
<img src='../static/assets/ui/pikachu2.png' alt='Pikachu' id='littlePikachu' class='popUpImg'/> | ||
</div> | ||
</div>` | ||
appScreen.innerHTML += helpScreenTemplate; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export const showAPopUpScreen = (screenToDisplay) => { | ||
// display the help screen | ||
screenToDisplay.style.display = 'initial'; | ||
// add blur to the rest of the page | ||
document.querySelectorAll('.disableWithPopUpScreen').forEach(e => e.style.filter = 'blur(4px)'); | ||
// function which gets called when the exit button is clicked | ||
const exitPopUpFunction = () => { | ||
//hide the screen | ||
screenToDisplay.style.display = 'none'; | ||
// remove the blur | ||
document.querySelectorAll('.disableWithPopUpScreen').forEach(e => e.style.filter = 'blur(0)'); | ||
// remove the event listener | ||
screenToDisplay.querySelector('.exitPopUpScreen').removeEventListener('click', exitPopUpFunction); | ||
}; | ||
// add event listener to the exit button; | ||
screenToDisplay.querySelector('.exitPopUpScreen').addEventListener('click', exitPopUpFunction); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,35 @@ | ||
export const showStartingPage = () => { | ||
const appScreen = document.querySelector('#pokequiz-app'); | ||
const startingPageTemplate = | ||
`<div id="headerWithLogo" class="firstColumn spanInPortrait"> | ||
`<div id="headerWithLogo" class="firstColumn spanInPortrait disableWithPopUpScreen"> | ||
<img src="./static/assets/ui/logo.png" alt='Pokemon' id='pokemonLogo'/> | ||
<p id='quizLogo' class='fancyFontStyle'>Quiz</p> | ||
</div> | ||
<ul id="selectModeMenu" class="firstColumn spanInPortrait"> | ||
<li id='whoIsThatPokemonOption' class="buttonWithText">Who's that pokemon?</li> | ||
<li id='whatItLooksLikeOption' class="buttonWithText">What it looks like?</li> | ||
<li id='guessTheTypeOption' class="buttonWithText">Guess the type!</li> | ||
</ul> | ||
<ul id="selectModeMenu" class="firstColumn spanInPortrait disableWithPopUpScreen"> | ||
<li id='whoIsThatPokemonOption' class="buttonWithText">Who's that pokemon?</li> | ||
<li id='whatItLooksLikeOption' class="buttonWithText">What it looks like?</li> | ||
<li id='guessTheTypeOption' class="buttonWithText">Guess the type!</li> | ||
</ul> | ||
<div id='enterNameAndPlayMenu' class="secondColumn spanInPortrait"> | ||
<div id='enterNameAndPlayMenu' class="secondColumn spanInPortrait disableWithPopUpScreen"> | ||
<p id='enterYourName' class='fancyFontStyle'>ENTER YOUR NAME</p> | ||
<div id='enterYourNameArea'> | ||
<img src='https://cdn4.iconfinder.com/data/icons/small-n-flat/24/user-alt-512.png' alt='playerIcon' id='playerIcon'/> | ||
<input type='text' id='enterYourNameInput'> | ||
</div> | ||
</div> | ||
<div id='startGame' class="secondColumn spanInPortrait"> | ||
<div id='startGame' class="secondColumn spanInPortrait disableWithPopUpScreen"> | ||
<input type='button' id='startGameButton' class="buttonWithText" value='PLAY'> | ||
</div> | ||
<ul class='bottomOfThePageOptions firstColumn'> | ||
<ul class='bottomOfThePageOptions firstColumn disableWithPopUpScreen'> | ||
<li id='helpOption'>?</li> | ||
<li id='leaderboard'><i class="fa fa-trophy"></i></li> | ||
</ul> | ||
<img src='./static/assets/ui/pikach1.png' alt='Pikachu' id='pikachuImg' class="secondColumn"/>` | ||
<img src='./static/assets/ui/pikach1.png' alt='Pikachu' id='pikachuImg' class="secondColumn disableWithPopUpScreen"/> | ||
` | ||
appScreen.innerHTML = startingPageTemplate; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters