Skip to content

Commit

Permalink
Added all resources files of working demo
Browse files Browse the repository at this point in the history
  • Loading branch information
YT-PixelPerfectLabs committed Dec 29, 2024
1 parent 4df1fe3 commit 3517d61
Show file tree
Hide file tree
Showing 10 changed files with 9,467 additions and 0 deletions.
2,849 changes: 2,849 additions & 0 deletions index.html

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var btnDraw = document.querySelectorAll(".btn-draw");
var btnErase = document.querySelectorAll(".btn-erase");

// We are only adding and removing the 'active' class,
// the entire animation is defined in the CSS code
function draw(btn) {
btn.parentElement.parentElement.classList.add("active");
btn.parentElement.parentElement.querySelector("svg").classList.add("active");
}

function erase(btn) {
btn.parentElement.parentElement.classList.remove("active");
btn.parentElement.parentElement
.querySelector("svg")
.classList.remove("active");
}

// Add handlers to our buttons
btnDraw.forEach((btn) => {
btn.addEventListener("click", () => draw(btn), false);
});

btnErase.forEach((btn) => {
btn.addEventListener("click", () => erase(btn), false);
});
95 changes: 95 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
* {
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
background-color: #eeeeee;
}

h1 {
text-align: center;
margin-bottom: 50px;
}

.container {
max-width: 824px;
margin: 0 auto;
padding: 40px 24px;
}

.row {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
}

.svg-box {
width: calc(50% - 24px);
padding: 24px 24px 0;
border: 1px solid #eaeaea;
margin: 0 auto 24px;
background-color: #fff;
}

.btn-draw,
.btn-erase {
background-color: transparent;
border: 0;
outline: none;
font-weight: 500;
text-transform: uppercase;
padding: 16px 24px;
border: 1px solid #e3e3e3;
cursor: pointer;
transition: 0.3s ease;
margin-bottom: 8px;
}

.btn-draw:hover,
.btn-erase:hover {
border: 1px solid #000000;
}

.btn-erase {
opacity: 0.5;
cursor: not-allowed;
}

.active .btn-draw {
opacity: 0.5;
cursor: not-allowed;
}

.active .btn-erase {
opacity: 1;
cursor: pointer;
}

.svg-box svg {
width: 100%;
}

.action {
padding: 24px;
border-top: 1px solid #eaeaea;
border-left: 0;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-around;
margin-left: -24px;
margin-right: -24px;
}

@media (max-width: 575.98px) {
h1 {
font-size: 24px;
}
.svg-box {
width: calc(100% - 24px);
}
}
Loading

0 comments on commit 3517d61

Please sign in to comment.