refactor: Use standard components for num of floors
This commit is contained in:
parent
ee0ba6acf8
commit
a6b88b4bb7
@ -92,9 +92,7 @@
|
|||||||
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
<button id="decreaseFloorNum">-</button>
|
<input type="number" id="numFullFloors" value="3" step="1">
|
||||||
<input type="text" id="numFullFloors" value="3" readonly>
|
|
||||||
<button id="increaseFloorNum">+</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="column">
|
<div class="column">
|
||||||
|
35
src/index.js
35
src/index.js
@ -212,13 +212,6 @@ class Dimensions {
|
|||||||
// DOCUMENT INTERACTION //
|
// DOCUMENT INTERACTION //
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
|
|
||||||
const inputDecreaseFloorNum = document.getElementById("decreaseFloorNum");
|
|
||||||
inputDecreaseFloorNum.onclick = decreaseFloorNum;
|
|
||||||
|
|
||||||
const inputIncreaseFloorNum = document.getElementById("increaseFloorNum");
|
|
||||||
inputIncreaseFloorNum.onclick = increaseFloorNum;
|
|
||||||
|
|
||||||
|
|
||||||
const inputWidth = document.getElementById("width");
|
const inputWidth = document.getElementById("width");
|
||||||
inputWidth.onchange = updateViaManualMeasurements;
|
inputWidth.onchange = updateViaManualMeasurements;
|
||||||
const inputDepth = document.getElementById("depth");
|
const inputDepth = document.getElementById("depth");
|
||||||
@ -228,17 +221,19 @@ inputHeight.onchange = updateViaManualMeasurements;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
var labelNumRats = document.getElementById("labelNumRats");
|
let labelNumRats = document.getElementById("labelNumRats");
|
||||||
|
|
||||||
var ratSlider = document.getElementById("numRats");
|
let ratSlider = document.getElementById("numRats");
|
||||||
|
|
||||||
ratSlider.oninput = function () {
|
ratSlider.oninput = function () {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Full floor functions
|
// Full floor functions
|
||||||
var fullFloorNum = document.getElementById("numFullFloors");
|
let fullFloorNum = document.getElementById("numFullFloors");
|
||||||
|
fullFloorNum.oninput = function () {
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
function getResultFromChecks(checks) {
|
function getResultFromChecks(checks) {
|
||||||
if (Object.keys(checks).length > 0) {
|
if (Object.keys(checks).length > 0) {
|
||||||
@ -277,21 +272,3 @@ function update() {
|
|||||||
resultsDiv.innerHTML = "";
|
resultsDiv.innerHTML = "";
|
||||||
resultsDiv.appendChild(result);
|
resultsDiv.appendChild(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function decreaseFloorNum() {
|
|
||||||
var input = document.getElementById('numFullFloors');
|
|
||||||
var value = parseInt(input.value);
|
|
||||||
if (value > 0) {
|
|
||||||
input.value = value - 1;
|
|
||||||
}
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
function increaseFloorNum() {
|
|
||||||
var input = document.getElementById('numFullFloors');
|
|
||||||
var value = parseInt(input.value);
|
|
||||||
input.value = value + 1;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user