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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Modern Todo App</title>
|
| 7 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 8 |
+
<style>
|
| 9 |
+
:root {
|
| 10 |
+
--primary: #4361ee;
|
| 11 |
+
--secondary: #3f37c9;
|
| 12 |
+
--accent: #4895ef;
|
| 13 |
+
--light: #f8f9fa;
|
| 14 |
+
--dark: #212529;
|
| 15 |
+
--success: #4cc9f0;
|
| 16 |
+
--danger: #f72585;
|
| 17 |
+
--warning: #f8961e;
|
| 18 |
+
--info: #560bad;
|
| 19 |
+
--border-radius: 8px;
|
| 20 |
+
--shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 21 |
+
--transition: all 0.3s ease;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
* {
|
| 25 |
+
margin: 0;
|
| 26 |
+
padding: 0;
|
| 27 |
+
box-sizing: border-box;
|
| 28 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
body {
|
| 32 |
+
background-color: #f5f7fa;
|
| 33 |
+
color: var(--dark);
|
| 34 |
+
line-height: 1.6;
|
| 35 |
+
padding: 20px;
|
| 36 |
+
min-height: 100vh;
|
| 37 |
+
display: flex;
|
| 38 |
+
flex-direction: column;
|
| 39 |
+
align-items: center;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
.container {
|
| 43 |
+
width: 100%;
|
| 44 |
+
max-width: 600px;
|
| 45 |
+
background: white;
|
| 46 |
+
border-radius: var(--border-radius);
|
| 47 |
+
box-shadow: var(--shadow);
|
| 48 |
+
padding: 2rem;
|
| 49 |
+
margin-top: 2rem;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
h1 {
|
| 53 |
+
color: var(--primary);
|
| 54 |
+
text-align: center;
|
| 55 |
+
margin-bottom: 1.5rem;
|
| 56 |
+
font-weight: 700;
|
| 57 |
+
font-size: 2.2rem;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
.input-container {
|
| 61 |
+
display: flex;
|
| 62 |
+
gap: 10px;
|
| 63 |
+
margin-bottom: 1.5rem;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
#task-input {
|
| 67 |
+
flex: 1;
|
| 68 |
+
padding: 12px 15px;
|
| 69 |
+
border: 2px solid #e9ecef;
|
| 70 |
+
border-radius: var(--border-radius);
|
| 71 |
+
font-size: 1rem;
|
| 72 |
+
transition: var(--transition);
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
#task-input:focus {
|
| 76 |
+
outline: none;
|
| 77 |
+
border-color: var(--accent);
|
| 78 |
+
box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
#add-btn {
|
| 82 |
+
background-color: var(--primary);
|
| 83 |
+
color: white;
|
| 84 |
+
border: none;
|
| 85 |
+
padding: 12px 20px;
|
| 86 |
+
border-radius: var(--border-radius);
|
| 87 |
+
cursor: pointer;
|
| 88 |
+
font-weight: 600;
|
| 89 |
+
transition: var(--transition);
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
#add-btn:hover {
|
| 93 |
+
background-color: var(--secondary);
|
| 94 |
+
transform: translateY(-2px);
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
.task-list {
|
| 98 |
+
list-style: none;
|
| 99 |
+
margin-top: 1.5rem;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
.task-item {
|
| 103 |
+
display: flex;
|
| 104 |
+
align-items: center;
|
| 105 |
+
padding: 12px 15px;
|
| 106 |
+
background-color: white;
|
| 107 |
+
border-radius: var(--border-radius);
|
| 108 |
+
margin-bottom: 10px;
|
| 109 |
+
box-shadow: var(--shadow);
|
| 110 |
+
transition: var(--transition);
|
| 111 |
+
border-left: 4px solid transparent;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
.task-item:hover {
|
| 115 |
+
transform: translateY(-2px);
|
| 116 |
+
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
.task-item.completed {
|
| 120 |
+
opacity: 0.7;
|
| 121 |
+
border-left-color: var(--success);
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
.task-item.completed .task-text {
|
| 125 |
+
text-decoration: line-through;
|
| 126 |
+
color: #6c757d;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
.task-checkbox {
|
| 130 |
+
margin-right: 15px;
|
| 131 |
+
width: 20px;
|
| 132 |
+
height: 20px;
|
| 133 |
+
cursor: pointer;
|
| 134 |
+
accent-color: var(--success);
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
.task-text {
|
| 138 |
+
flex: 1;
|
| 139 |
+
font-size: 1rem;
|
| 140 |
+
word-break: break-word;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
.delete-btn {
|
| 144 |
+
background: none;
|
| 145 |
+
border: none;
|
| 146 |
+
color: var(--danger);
|
| 147 |
+
cursor: pointer;
|
| 148 |
+
font-size: 1.2rem;
|
| 149 |
+
margin-left: 10px;
|
| 150 |
+
transition: var(--transition);
|
| 151 |
+
opacity: 0.7;
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
.delete-btn:hover {
|
| 155 |
+
opacity: 1;
|
| 156 |
+
transform: scale(1.1);
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
.stats {
|
| 160 |
+
display: flex;
|
| 161 |
+
justify-content: space-between;
|
| 162 |
+
margin-top: 1.5rem;
|
| 163 |
+
padding-top: 1rem;
|
| 164 |
+
border-top: 1px solid #e9ecef;
|
| 165 |
+
color: #6c757d;
|
| 166 |
+
font-size: 0.9rem;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
.filter-buttons {
|
| 170 |
+
display: flex;
|
| 171 |
+
gap: 10px;
|
| 172 |
+
margin-top: 1rem;
|
| 173 |
+
justify-content: center;
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
.filter-btn {
|
| 177 |
+
padding: 8px 12px;
|
| 178 |
+
border-radius: var(--border-radius);
|
| 179 |
+
border: 1px solid #e9ecef;
|
| 180 |
+
background: white;
|
| 181 |
+
cursor: pointer;
|
| 182 |
+
transition: var(--transition);
|
| 183 |
+
font-size: 0.85rem;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
.filter-btn.active {
|
| 187 |
+
background-color: var(--primary);
|
| 188 |
+
color: white;
|
| 189 |
+
border-color: var(--primary);
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
.filter-btn:hover {
|
| 193 |
+
background-color: #e9ecef;
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
.filter-btn.active:hover {
|
| 197 |
+
background-color: var(--secondary);
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
.empty-state {
|
| 201 |
+
text-align: center;
|
| 202 |
+
padding: 2rem 0;
|
| 203 |
+
color: #6c757d;
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
.empty-state i {
|
| 207 |
+
font-size: 3rem;
|
| 208 |
+
margin-bottom: 1rem;
|
| 209 |
+
color: #e9ecef;
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
@media (max-width: 600px) {
|
| 213 |
+
.container {
|
| 214 |
+
padding: 1.5rem;
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
h1 {
|
| 218 |
+
font-size: 1.8rem;
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
.input-container {
|
| 222 |
+
flex-direction: column;
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
#add-btn {
|
| 226 |
+
width: 100%;
|
| 227 |
+
}
|
| 228 |
+
}
|
| 229 |
+
</style>
|
| 230 |
+
</head>
|
| 231 |
+
<body>
|
| 232 |
+
<div class="container">
|
| 233 |
+
<h1>Todo App</h1>
|
| 234 |
+
|
| 235 |
+
<div class="input-container">
|
| 236 |
+
<input type="text" id="task-input" placeholder="Add a new task..." autofocus>
|
| 237 |
+
<button id="add-btn">Add Task</button>
|
| 238 |
+
</div>
|
| 239 |
+
|
| 240 |
+
<div class="filter-buttons">
|
| 241 |
+
<button class="filter-btn active" data-filter="all">All</button>
|
| 242 |
+
<button class="filter-btn" data-filter="active">Active</button>
|
| 243 |
+
<button class="filter-btn" data-filter="completed">Completed</button>
|
| 244 |
+
</div>
|
| 245 |
+
|
| 246 |
+
<ul class="task-list" id="task-list">
|
| 247 |
+
<!-- Tasks will be added here dynamically -->
|
| 248 |
+
<div class="empty-state">
|
| 249 |
+
<i class="fas fa-clipboard-list"></i>
|
| 250 |
+
<p>No tasks yet. Add one above!</p>
|
| 251 |
+
</div>
|
| 252 |
+
</ul>
|
| 253 |
+
|
| 254 |
+
<div class="stats">
|
| 255 |
+
<span id="total-tasks">0 tasks</span>
|
| 256 |
+
<span id="completed-tasks">0 completed</span>
|
| 257 |
+
</div>
|
| 258 |
+
</div>
|
| 259 |
+
|
| 260 |
+
<script>
|
| 261 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 262 |
+
const taskInput = document.getElementById('task-input');
|
| 263 |
+
const addBtn = document.getElementById('add-btn');
|
| 264 |
+
const taskList = document.getElementById('task-list');
|
| 265 |
+
const totalTasksSpan = document.getElementById('total-tasks');
|
| 266 |
+
const completedTasksSpan = document.getElementById('completed-tasks');
|
| 267 |
+
const filterButtons = document.querySelectorAll('.filter-btn');
|
| 268 |
+
|
| 269 |
+
let tasks = JSON.parse(localStorage.getItem('tasks')) || [];
|
| 270 |
+
let currentFilter = 'all';
|
| 271 |
+
|
| 272 |
+
// Render tasks based on current filter
|
| 273 |
+
function renderTasks() {
|
| 274 |
+
taskList.innerHTML = '';
|
| 275 |
+
|
| 276 |
+
const filteredTasks = tasks.filter(task => {
|
| 277 |
+
if (currentFilter === 'all') return true;
|
| 278 |
+
if (currentFilter === 'active') return !task.completed;
|
| 279 |
+
if (currentFilter === 'completed') return task.completed;
|
| 280 |
+
});
|
| 281 |
+
|
| 282 |
+
if (filteredTasks.length === 0) {
|
| 283 |
+
taskList.innerHTML = `
|
| 284 |
+
<div class="empty-state">
|
| 285 |
+
<i class="fas fa-clipboard-list"></i>
|
| 286 |
+
<p>No ${currentFilter} tasks found.</p>
|
| 287 |
+
</div>
|
| 288 |
+
`;
|
| 289 |
+
return;
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
filteredTasks.forEach((task, index) => {
|
| 293 |
+
const taskItem = document.createElement('li');
|
| 294 |
+
taskItem.className = `task-item ${task.completed ? 'completed' : ''}`;
|
| 295 |
+
taskItem.innerHTML = `
|
| 296 |
+
<input type="checkbox" class="task-checkbox" ${task.completed ? 'checked' : ''} data-id="${task.id}">
|
| 297 |
+
<span class="task-text">${task.text}</span>
|
| 298 |
+
<button class="delete-btn" data-id="${task.id}">
|
| 299 |
+
<i class="fas fa-trash"></i>
|
| 300 |
+
</button>
|
| 301 |
+
`;
|
| 302 |
+
taskList.appendChild(taskItem);
|
| 303 |
+
});
|
| 304 |
+
|
| 305 |
+
updateStats();
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
// Update task statistics
|
| 309 |
+
function updateStats() {
|
| 310 |
+
const totalTasks = tasks.length;
|
| 311 |
+
const completedTasks = tasks.filter(task => task.completed).length;
|
| 312 |
+
|
| 313 |
+
totalTasksSpan.textContent = `${totalTasks} ${totalTasks === 1 ? 'task' : 'tasks'}`;
|
| 314 |
+
completedTasksSpan.textContent = `${completedTasks} completed`;
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
// Add new task
|
| 318 |
+
function addTask() {
|
| 319 |
+
const text = taskInput.value.trim();
|
| 320 |
+
if (text === '') return;
|
| 321 |
+
|
| 322 |
+
const newTask = {
|
| 323 |
+
id: Date.now(),
|
| 324 |
+
text,
|
| 325 |
+
completed: false
|
| 326 |
+
};
|
| 327 |
+
|
| 328 |
+
tasks.push(newTask);
|
| 329 |
+
saveTasks();
|
| 330 |
+
taskInput.value = '';
|
| 331 |
+
renderTasks();
|
| 332 |
+
}
|
| 333 |
+
|
| 334 |
+
// Toggle task completion status
|
| 335 |
+
function toggleTask(id) {
|
| 336 |
+
tasks = tasks.map(task => {
|
| 337 |
+
if (task.id === id) {
|
| 338 |
+
return { ...task, completed: !task.completed };
|
| 339 |
+
}
|
| 340 |
+
return task;
|
| 341 |
+
});
|
| 342 |
+
saveTasks();
|
| 343 |
+
renderTasks();
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
// Delete task
|
| 347 |
+
function deleteTask(id) {
|
| 348 |
+
tasks = tasks.filter(task => task.id !== id);
|
| 349 |
+
saveTasks();
|
| 350 |
+
renderTasks();
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
// Save tasks to localStorage
|
| 354 |
+
function saveTasks() {
|
| 355 |
+
localStorage.setItem('tasks', JSON.stringify(tasks));
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
// Event listeners
|
| 359 |
+
addBtn.addEventListener('click', addTask);
|
| 360 |
+
|
| 361 |
+
taskInput.addEventListener('keypress', function(e) {
|
| 362 |
+
if (e.key === 'Enter') {
|
| 363 |
+
addTask();
|
| 364 |
+
}
|
| 365 |
+
});
|
| 366 |
+
|
| 367 |
+
taskList.addEventListener('click', function(e) {
|
| 368 |
+
if (e.target.classList.contains('task-checkbox')) {
|
| 369 |
+
const id = parseInt(e.target.getAttribute('data-id'));
|
| 370 |
+
toggleTask(id);
|
| 371 |
+
}
|
| 372 |
+
|
| 373 |
+
if (e.target.classList.contains('delete-btn') || e.target.closest('.delete-btn')) {
|
| 374 |
+
const id = parseInt(e.target.closest('.delete-btn').getAttribute('data-id'));
|
| 375 |
+
deleteTask(id);
|
| 376 |
+
}
|
| 377 |
+
});
|
| 378 |
+
|
| 379 |
+
filterButtons.forEach(button => {
|
| 380 |
+
button.addEventListener('click', function() {
|
| 381 |
+
filterButtons.forEach(btn => btn.classList.remove('active'));
|
| 382 |
+
this.classList.add('active');
|
| 383 |
+
currentFilter = this.getAttribute('data-filter');
|
| 384 |
+
renderTasks();
|
| 385 |
+
});
|
| 386 |
+
});
|
| 387 |
+
|
| 388 |
+
// Initial render
|
| 389 |
+
renderTasks();
|
| 390 |
+
});
|
| 391 |
+
</script>
|
| 392 |
+
</body>
|
| 393 |
+
</html>
|