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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>To-Do List 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-color: #6c5ce7;
|
| 11 |
+
--secondary-color: #a29bfe;
|
| 12 |
+
--text-color: #2d3436;
|
| 13 |
+
--light-gray: #f5f6fa;
|
| 14 |
+
--shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
* {
|
| 18 |
+
margin: 0;
|
| 19 |
+
padding: 0;
|
| 20 |
+
box-sizing: border-box;
|
| 21 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
body {
|
| 25 |
+
background-color: var(--light-gray);
|
| 26 |
+
color: var(--text-color);
|
| 27 |
+
line-height: 1.6;
|
| 28 |
+
padding: 20px;
|
| 29 |
+
min-height: 100vh;
|
| 30 |
+
display: flex;
|
| 31 |
+
flex-direction: column;
|
| 32 |
+
align-items: center;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
.container {
|
| 36 |
+
max-width: 600px;
|
| 37 |
+
width: 100%;
|
| 38 |
+
background: white;
|
| 39 |
+
border-radius: 10px;
|
| 40 |
+
box-shadow: var(--shadow);
|
| 41 |
+
padding: 30px;
|
| 42 |
+
margin-top: 20px;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
header {
|
| 46 |
+
text-align: center;
|
| 47 |
+
margin-bottom: 30px;
|
| 48 |
+
width: 100%;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
header h1 {
|
| 52 |
+
color: var(--primary-color);
|
| 53 |
+
margin-bottom: 10px;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
.header-top {
|
| 57 |
+
display: flex;
|
| 58 |
+
justify-content: space-between;
|
| 59 |
+
align-items: center;
|
| 60 |
+
margin-bottom: 10px;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
.header-top a {
|
| 64 |
+
color: var(--primary-color);
|
| 65 |
+
text-decoration: none;
|
| 66 |
+
font-size: 14px;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
.input-container {
|
| 70 |
+
display: flex;
|
| 71 |
+
margin-bottom: 20px;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
#task-input {
|
| 75 |
+
flex: 1;
|
| 76 |
+
padding: 15px;
|
| 77 |
+
border: 2px solid #dfe6e9;
|
| 78 |
+
border-radius: 5px 0 0 5px;
|
| 79 |
+
font-size: 16px;
|
| 80 |
+
transition: border-color 0.3s;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
#task-input:focus {
|
| 84 |
+
outline: none;
|
| 85 |
+
border-color: var(--primary-color);
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
#add-task {
|
| 89 |
+
background-color: var(--primary-color);
|
| 90 |
+
color: white;
|
| 91 |
+
border: none;
|
| 92 |
+
padding: 0 20px;
|
| 93 |
+
border-radius: 0 5px 5px 0;
|
| 94 |
+
cursor: pointer;
|
| 95 |
+
font-size: 16px;
|
| 96 |
+
transition: background-color 0.3s;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
#add-task:hover {
|
| 100 |
+
background-color: #5649c0;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
.task-list {
|
| 104 |
+
list-style: none;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
.task-item {
|
| 108 |
+
display: flex;
|
| 109 |
+
justify-content: space-between;
|
| 110 |
+
align-items: center;
|
| 111 |
+
padding: 15px;
|
| 112 |
+
background-color: white;
|
| 113 |
+
border-radius: 5px;
|
| 114 |
+
margin-bottom: 10px;
|
| 115 |
+
box-shadow: var(--shadow);
|
| 116 |
+
transition: transform 0.2s, box-shadow 0.2s;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
.task-item:hover {
|
| 120 |
+
transform: translateY(-2px);
|
| 121 |
+
box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
.task-item.completed {
|
| 125 |
+
opacity: 0.7;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
.task-item.completed .task-text {
|
| 129 |
+
text-decoration: line-through;
|
| 130 |
+
color: #7f8c8d;
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
.task-text {
|
| 134 |
+
flex: 1;
|
| 135 |
+
margin-left: 10px;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
.task-actions {
|
| 139 |
+
display: flex;
|
| 140 |
+
gap: 10px;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
.task-actions button {
|
| 144 |
+
background: none;
|
| 145 |
+
border: none;
|
| 146 |
+
color: #7f8c8d;
|
| 147 |
+
cursor: pointer;
|
| 148 |
+
font-size: 16px;
|
| 149 |
+
transition: color 0.2s;
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
.task-actions button:hover {
|
| 153 |
+
color: var(--primary-color);
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
.task-actions .complete-btn.completed {
|
| 157 |
+
color: #2ecc71;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
.stats {
|
| 161 |
+
display: flex;
|
| 162 |
+
justify-content: space-between;
|
| 163 |
+
margin-top: 20px;
|
| 164 |
+
padding-top: 20px;
|
| 165 |
+
border-top: 1px solid #dfe6e9;
|
| 166 |
+
font-size: 14px;
|
| 167 |
+
color: #7f8c8d;
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
@media (max-width: 480px) {
|
| 171 |
+
.container {
|
| 172 |
+
padding: 20px;
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
.input-container {
|
| 176 |
+
flex-direction: column;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
#task-input {
|
| 180 |
+
border-radius: 5px;
|
| 181 |
+
margin-bottom: 10px;
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
#add-task {
|
| 185 |
+
border-radius: 5px;
|
| 186 |
+
padding: 12px;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
.task-item {
|
| 190 |
+
flex-direction: column;
|
| 191 |
+
align-items: flex-start;
|
| 192 |
+
gap: 10px;
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
.task-actions {
|
| 196 |
+
width: 100%;
|
| 197 |
+
justify-content: flex-end;
|
| 198 |
+
}
|
| 199 |
+
}
|
| 200 |
+
</style>
|
| 201 |
+
</head>
|
| 202 |
+
<body>
|
| 203 |
+
<div class="container">
|
| 204 |
+
<header>
|
| 205 |
+
<div class="header-top">
|
| 206 |
+
<h1>To-Do List</h1>
|
| 207 |
+
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">Built with anycoder</a>
|
| 208 |
+
</div>
|
| 209 |
+
<p>Organize your tasks efficiently</p>
|
| 210 |
+
</header>
|
| 211 |
+
|
| 212 |
+
<div class="input-container">
|
| 213 |
+
<input type="text" id="task-input" placeholder="Add a new task...">
|
| 214 |
+
<button id="add-task"><i class="fas fa-plus"></i></button>
|
| 215 |
+
</div>
|
| 216 |
+
|
| 217 |
+
<ul class="task-list" id="task-list">
|
| 218 |
+
<!-- Tasks will be added here dynamically -->
|
| 219 |
+
</ul>
|
| 220 |
+
|
| 221 |
+
<div class="stats">
|
| 222 |
+
<span id="total-tasks">0 tasks</span>
|
| 223 |
+
<span id="completed-tasks">0 completed</span>
|
| 224 |
+
</div>
|
| 225 |
+
</div>
|
| 226 |
+
|
| 227 |
+
<script>
|
| 228 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 229 |
+
const taskInput = document.getElementById('task-input');
|
| 230 |
+
const addTaskBtn = document.getElementById('add-task');
|
| 231 |
+
const taskList = document.getElementById('task-list');
|
| 232 |
+
const totalTasks = document.getElementById('total-tasks');
|
| 233 |
+
const completedTasks = document.getElementById('completed-tasks');
|
| 234 |
+
|
| 235 |
+
let tasks = JSON.parse(localStorage.getItem('tasks')) || [];
|
| 236 |
+
|
| 237 |
+
// Render tasks
|
| 238 |
+
function renderTasks() {
|
| 239 |
+
taskList.innerHTML = '';
|
| 240 |
+
let total = 0;
|
| 241 |
+
let completed = 0;
|
| 242 |
+
|
| 243 |
+
tasks.forEach((task, index) => {
|
| 244 |
+
const taskItem = document.createElement('li');
|
| 245 |
+
taskItem.className = `task-item ${task.completed ? 'completed' : ''}`;
|
| 246 |
+
taskItem.innerHTML = `
|
| 247 |
+
<div class="task-content">
|
| 248 |
+
<i class="fas fa-${task.completed ? 'check-circle' : 'circle'}"></i>
|
| 249 |
+
<span class="task-text">${task.text}</span>
|
| 250 |
+
</div>
|
| 251 |
+
<div class="task-actions">
|
| 252 |
+
<button class="complete-btn" data-index="${index}">
|
| 253 |
+
<i class="fas fa-${task.completed ? 'undo' : 'check'}"></i>
|
| 254 |
+
</button>
|
| 255 |
+
<button class="delete-btn" data-index="${index}">
|
| 256 |
+
<i class="fas fa-trash"></i>
|
| 257 |
+
</button>
|
| 258 |
+
</div>
|
| 259 |
+
`;
|
| 260 |
+
taskList.appendChild(taskItem);
|
| 261 |
+
|
| 262 |
+
total++;
|
| 263 |
+
if (task.completed) completed++;
|
| 264 |
+
});
|
| 265 |
+
|
| 266 |
+
totalTasks.textContent = `${total} task${total !== 1 ? 's' : ''}`;
|
| 267 |
+
completedTasks.textContent = `${completed} completed`;
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
// Add new task
|
| 271 |
+
function addTask() {
|
| 272 |
+
const text = taskInput.value.trim();
|
| 273 |
+
if (text) {
|
| 274 |
+
tasks.push({ text, completed: false });
|
| 275 |
+
saveTasks();
|
| 276 |
+
taskInput.value = '';
|
| 277 |
+
renderTasks();
|
| 278 |
+
}
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
// Toggle task completion
|
| 282 |
+
function toggleTask(index) {
|
| 283 |
+
tasks[index].completed = !tasks[index].completed;
|
| 284 |
+
saveTasks();
|
| 285 |
+
renderTasks();
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
// Delete task
|
| 289 |
+
function deleteTask(index) {
|
| 290 |
+
tasks.splice(index, 1);
|
| 291 |
+
saveTasks();
|
| 292 |
+
renderTasks();
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
// Save tasks to localStorage
|
| 296 |
+
function saveTasks() {
|
| 297 |
+
localStorage.setItem('tasks', JSON.stringify(tasks));
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
+
// Event listeners
|
| 301 |
+
addTaskBtn.addEventListener('click', addTask);
|
| 302 |
+
|
| 303 |
+
taskInput.addEventListener('keypress', function(e) {
|
| 304 |
+
if (e.key === 'Enter') addTask();
|
| 305 |
+
});
|
| 306 |
+
|
| 307 |
+
taskList.addEventListener('click', function(e) {
|
| 308 |
+
if (e.target.closest('.complete-btn')) {
|
| 309 |
+
const index = e.target.closest('.complete-btn').dataset.index;
|
| 310 |
+
toggleTask(index);
|
| 311 |
+
} else if (e.target.closest('.delete-btn')) {
|
| 312 |
+
const index = e.target.closest('.delete-btn').dataset.index;
|
| 313 |
+
deleteTask(index);
|
| 314 |
+
}
|
| 315 |
+
});
|
| 316 |
+
|
| 317 |
+
// Initial render
|
| 318 |
+
renderTasks();
|
| 319 |
+
});
|
| 320 |
+
</script>
|
| 321 |
+
</body>
|
| 322 |
+
</html>
|