Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
eri-prado committed Oct 28, 2021
1 parent 0adc601 commit d7e82c4
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 25 deletions.
88 changes: 86 additions & 2 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,97 @@
body,
h1,
h1,
p,
ul,
li,
a,
ul,
li,
select,
option,
div {
margin: 0;
padding: 0;
list-style: none;
}

body {
font-size: 0.85rem;
font-family: "Montserrat", Helvetica, sans-serif;
}

h1 {
margin-bottom: 15px;
}

p {
padding: 0 25px;
font-size: 1rem;
line-height: 1.5;
font-weight: 300;
}

.container {
display: flex;
flex-wrap: wrap;
max-width: 1080px;
flex-direction: column;
margin: 0 auto;
align-items: center;
flex-wrap: wrap;
}

.container-columns {
display: flex;
flex-wrap: wrap;
padding: 1rem 2rem;
margin: 0 0 1rem 0;
text-align: center;
align-items: center;
}

header {
.header {
margin: 25px 0;
text-align: center;
}

.types {
margin: 7px;
padding: 10px;
}

.types li {
padding: 9.5px 0;
}

.house {
margin: 5px;
padding: 10px;
border: 1px solid #dee2e6;
border-radius: 0.25rem;
}

select {
width: 100%;
padding: 0.375rem 0.75rem;
margin: 2px 0 3px 0;
font-family: inherit;
font-size: inherit;
font-weight: 400;
line-height: 1.5;
color: #212529;
background-color: #fff;
border: 1px solid #ced4da;
border-radius: 0.25rem;
cursor: pointer;
}

.clues {
display: flex;
line-height: 1.5;
}

.clues ul {
margin: 0 auto;
column-count: 2;
padding: 0 2rem;
}
36 changes: 18 additions & 18 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@

<body>
<div class="container">
<header>
<header class="header">
<h1>Teste de Einstein</h1>
<p>Albert Einstein criou este teste de QI (raciocínio lógico) no século passado e afirmou que 98% da população
mundial não era capaz de resolvê-lo. Será que você faz parte desse seleto grupo que consegue resolvê-lo?</p>
</header>
<div class="game">
<div class="container-columns">
<div class="column">
<span> </span>
<ul>
<div class="column1">
<span>&nbsp</span>
<ul class="types">
<li>Cor</li>
<li>Nacionalidade</li>
<li>Bebida</li>
Expand All @@ -29,13 +29,13 @@ <h1>Teste de Einstein</h1>
</ul>
</div>
<!-- House 1 -->
<div class="column">
<div class="column2">
<span class="title">Casa #1</span>
<ul class="house">
<!-- Colors -->
<li>
<select name="list" onchange="change(this)">
<option value="clean"></option>
<select class="colors" name="list" onchange="selectColor(this)">
<option value=""></option>
<option value="yellow">amarela</option>
<option value="blue">azul</option>
<option value="white">branca</option>
Expand Down Expand Up @@ -90,18 +90,18 @@ <h1>Teste de Einstein</h1>
</ul>
</div>
<!-- House 2 -->
<div class="column">
<div class="column3">
<span class="title">Casa #2</span>
<ul class="house">
<!-- Colors -->
<li>
<select>
<option value="-1"></option>
<option value="0">amarela</option>
<option value="1">azul</option>
<option value="2">branca</option>
<option value="3">verde</option>
<option value="4">vermelha</option>
<select class="colors" name="list" onchange="selectColor(this)">
<option value=""></option>
<option value="yellow">amarela</option>
<option value="blue">azul</option>
<option value="white">branca</option>
<option value="green">verde</option>
<option value="red">vermelha</option>
</select>
</li>
<!-- Nationalities -->
Expand Down Expand Up @@ -151,7 +151,7 @@ <h1>Teste de Einstein</h1>
</ul>
</div>
<!-- House 3 -->
<div class="column">
<div class="column4">
<span class="title">Casa #3</span>
<ul class="house">
<!-- Colors -->
Expand Down Expand Up @@ -212,7 +212,7 @@ <h1>Teste de Einstein</h1>
</ul>
</div>
<!-- House 4 -->
<div class="column">
<div class="column5">
<span class="title">Casa #4</span>
<ul class="house">
<!-- Colors -->
Expand Down Expand Up @@ -273,7 +273,7 @@ <h1>Teste de Einstein</h1>
</ul>
</div>
<!-- House 5 -->
<div class="column">
<div class="column6">
<span class="title">Casa #5</span>
<ul class="house">
<!-- Colors -->
Expand Down
49 changes: 44 additions & 5 deletions js/script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
function change(list) {
var optionValue = list.options[list.selectedIndex].value
var house = document.querySelector(".house")
house.style.background = optionValue
}
function selectColor(list) {
const houses = document.querySelectorAll(".house");
const optionValue = list.options[list.selectedIndex].value


function change(item) {
[].forEach.call(houses, house => {
if (house.className === optionValue) {
house.classList.toggle(optionValue)
}
})
item.classList.toggle(optionValue);
}

[].forEach.call(houses, house => {
house.addEventListener("change", function () {
change(this, optionValue)
})
})
}




// if (optionValue == "yellow") {
// house.classList.add('yellow')

// for (var i = 0; i < house.length; ++i) {
// var item = house[i]
// item.style.background = optionValue
// }

// house.style.background = optionValue

// function change(listColors) {
// var optionValue = listColors.options[listColors.selectedIndex].value
// var house = document.querySelectorAll(".house")
// for (var i = 0; i < house.length; ++i) {
// var item = house[i]
// item.style.background = optionValue
// }

// }

0 comments on commit d7e82c4

Please sign in to comment.