Skip to content

Commit

Permalink
edit: task num allowance, confetti colors
Browse files Browse the repository at this point in the history
  • Loading branch information
amylour committed Oct 6, 2024
1 parent 891e76f commit 2086921
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ function createTaskBox(text, size, completed, deleted) {
const sizeLimits = {
'priority': 1,
'small': 2,
'medium': 2,
'medium': 1,
'large': 1
};

if (existingTasks.length >= sizeLimits[size]) {
alert(`You can only have ${sizeLimits[size]} ${size} task(s).`);
alert(`You only need ${sizeLimits[size]} ${size} task(s) right now. Try clearing some tasks before adding more.`);
return null;
}

Expand All @@ -58,6 +58,18 @@ function createTaskBox(text, size, completed, deleted) {
const tickButton = document.createElement('button');
tickButton.textContent = '✔';
tickButton.className = 'tick-button';
tickButton.style.display = 'none'; // Initially hidden

// Show tick button on hover
taskBox.addEventListener('mouseenter', function() {
tickButton.style.display = 'inline';
});

// Hide tick button when not hovering
taskBox.addEventListener('mouseleave', function() {
tickButton.style.display = 'none';
});

tickButton.addEventListener('click', function(e) {
e.stopPropagation(); // Prevent triggering the task box click event
showConfetti(); // Trigger confetti effect
Expand Down Expand Up @@ -85,6 +97,7 @@ function showConfetti() {
confetti({
particleCount: 100,
spread: 70,
origin: { y: 0.6 }
origin: { y: 0.6 },
colors: ['#173F5F', '#20639B', '#3CAEA3', '#F6D55C', '#ED553B', '#6C757D'], // Custom colors
});
}

0 comments on commit 2086921

Please sign in to comment.