Settings menu now works, although being unfinished

This commit is contained in:
Maciej Gomola 2024-10-17 16:38:32 +02:00
parent 8e0a784178
commit 1ca53ceb0c
3 changed files with 37 additions and 1 deletions

View File

@ -53,7 +53,6 @@ button {
font-optical-sizing: auto; font-optical-sizing: auto;
font-weight: 400; font-weight: 400;
font-style: normal; font-style: normal;
user-select: none;
transform: scale(1.2); transform: scale(1.2);
filter: blur(10px); filter: blur(10px);
@ -84,3 +83,28 @@ body.history-open .calculator {
filter: blur(10px); filter: blur(10px);
opacity: 0.4; opacity: 0.4;
} }
.settings-container {
position: absolute;
width: 100%;
height: 80%;
bottom: -80%;
left: 0;
font-family: "IBM Plex", sans-serif;
font-optical-sizing: auto;
font-weight: 400;
font-style: normal;
z-index: 150;
transition: all 0.4s;
}
body.settings-open .settings-container {
bottom: 0;
}
body.settings-open .calculator {
transform: translateY(-80%);
}

View File

@ -13,6 +13,8 @@ buttons.forEach(button => {
resetCalculator(); resetCalculator();
} else if (value === 'H') { } else if (value === 'H') {
toggleHistory(); toggleHistory();
} else if (value === '') {
toggleSettings();
} else if (value === '=') { } else if (value === '=') {
calculateResult(); calculateResult();
} else { } else {
@ -134,6 +136,10 @@ function toggleHistory() {
} }
} }
function toggleSettings() {
$('body').toggleClass('settings-open');
}
$('#history').on('click', toggleHistory); $('#history').on('click', toggleHistory);
function clearDisplay() { function clearDisplay() {

View File

@ -50,6 +50,12 @@
<button class="button">.</button> <button class="button">.</button>
<button class="button operation">=</button> <button class="button operation">=</button>
</div> </div>
<div class="settings-container">
<span>Kolor tła: </span><input type="color" id="background"><br>
<span>Kolor tekstu: </span><input type="color" id="text"><br>
<span>Kolor podstawowy: </span><input type="color" id="primary"><br>
<span>Kolor alternatywny: </span><input type="color" id="secondary">
</div>
<script src="./assets/js/calculator-logic.js"></script> <script src="./assets/js/calculator-logic.js"></script>
</body> </body>