Skip to content

Commit 555fe15

Browse files
committed
feat(CSS): add following declaration ow-gap: 10px
1 parent 0d7d74b commit 555fe15

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ body {
5959
flex-direction: column;
6060
margin-left: 10px;
6161
padding-top: 10px;
62+
row-gap: 10px;
6263
}
6364

6465

index.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const operators = document.querySelectorAll("[data-operator]");
88
const clearHistoryBtn = document.querySelector(".clear-history-btn");
99

1010

11-
console.log(computationHistoryParent);
11+
console.log(clearHistoryBtn);
1212

1313

1414

@@ -60,6 +60,8 @@ btns.forEach((btn) => {
6060

6161
convertToPercentage(buttonValue);
6262

63+
64+
6365

6466
});
6567
});
@@ -70,6 +72,12 @@ function convertToPercentage(button) {
7072
}
7173
}
7274

75+
clearHistoryBtn.addEventListener("click", () => {
76+
77+
historyElement.innerHTML = ""
78+
console.log(historyElement.childElementCount)
79+
})
80+
7381
function deteLastEntry(button) {
7482
if (button === "DE") {
7583
let newArray = data.slice(ZERO, -1);
@@ -226,7 +234,9 @@ function userClicksOnEqualButton(button) {
226234
data = [];
227235
data.push(result);
228236

229-
createHistoryList(historyEntries, historyElement, history)
237+
createHistoryList(historyEntries, historyElement, history);
238+
239+
togglesClearHistoryButton(historyElement, clearHistoryBtn);
230240

231241
// debugger
232242

@@ -280,13 +290,16 @@ function createHistoryList(array, element, history) {
280290
if(element.childElementCount > HISTORY_LIMIT) {
281291
element.firstElementChild.remove();
282292
}
283-
if(element.childElementCount > 0) {
284-
clearHistoryBtn.classList.toggle("display");
285-
console.log(historyElement.childElementCount)
286-
}
293+
287294

288295
});
289296
}
290297

298+
function togglesClearHistoryButton(element, btn) {
299+
if(element.childElementCount > 0) {
300+
btn.classList.toggle("display");
301+
}
302+
}
303+
291304

292305
// functions creations ends

0 commit comments

Comments
 (0)