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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>Todo App</title>
|
| 7 |
+
<style>
|
| 8 |
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
| 9 |
+
body {
|
| 10 |
+
font-family: 'Segoe UI', system-ui, sans-serif;
|
| 11 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 12 |
+
min-height: 100vh;
|
| 13 |
+
padding: 2rem;
|
| 14 |
+
display: grid;
|
| 15 |
+
place-items: center;
|
| 16 |
+
}
|
| 17 |
+
.container {
|
| 18 |
+
background: rgba(255, 255, 255, 0.95);
|
| 19 |
+
backdrop-filter: blur(10px);
|
| 20 |
+
border-radius: 20px;
|
| 21 |
+
padding: 2rem;
|
| 22 |
+
box-shadow: 0 20px 40px rgba(0,0,0,0.1);
|
| 23 |
+
width: 90%;
|
| 24 |
+
max-width: 500px;
|
| 25 |
+
}
|
| 26 |
+
h1 {
|
| 27 |
+
text-align: center;
|
| 28 |
+
color: #333;
|
| 29 |
+
margin-bottom: 1.5rem;
|
| 30 |
+
font-weight: 600;
|
| 31 |
+
}
|
| 32 |
+
.input-section {
|
| 33 |
+
display: flex;
|
| 34 |
+
gap: 0.5rem;
|
| 35 |
+
margin-bottom: 1.5rem;
|
| 36 |
+
}
|
| 37 |
+
input {
|
| 38 |
+
flex: 1;
|
| 39 |
+
padding: 0.75rem 1rem;
|
| 40 |
+
border: 2px solid #e1e5e9;
|
| 41 |
+
border-radius: 12px;
|
| 42 |
+
font-size: 1rem;
|
| 43 |
+
transition: all 0.3s ease;
|
| 44 |
+
}
|
| 45 |
+
input:focus {
|
| 46 |
+
outline: none;
|
| 47 |
+
border-color: #667eea;
|
| 48 |
+
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
| 49 |
+
}
|
| 50 |
+
button {
|
| 51 |
+
background: linear-gradient(135deg, #667eea, #764ba2);
|
| 52 |
+
color: white;
|
| 53 |
+
border: none;
|
| 54 |
+
padding: 0.75rem 1.5rem;
|
| 55 |
+
border-radius: 12px;
|
| 56 |
+
cursor: pointer;
|
| 57 |
+
font-weight: 600;
|
| 58 |
+
transition: transform 0.2s ease;
|
| 59 |
+
}
|
| 60 |
+
button:hover { transform: translateY(-2px); }
|
| 61 |
+
.todo-item {
|
| 62 |
+
background: white;
|
| 63 |
+
padding: 1rem;
|
| 64 |
+
margin-bottom: 0.5rem;
|
| 65 |
+
border-radius: 12px;
|
| 66 |
+
display: flex;
|
| 67 |
+
align-items: center;
|
| 68 |
+
gap: 1rem;
|
| 69 |
+
border: 2px solid #f0f0f0;
|
| 70 |
+
transition: all 0.3s ease;
|
| 71 |
+
}
|
| 72 |
+
.todo-item:hover {
|
| 73 |
+
border-color: #667eea;
|
| 74 |
+
transform: translateX(5px);
|
| 75 |
+
}
|
| 76 |
+
.todo-item.completed {
|
| 77 |
+
opacity: 0.6;
|
| 78 |
+
text-decoration: line-through;
|
| 79 |
+
}
|
| 80 |
+
.todo-text { flex: 1; }
|
| 81 |
+
.delete-btn {
|
| 82 |
+
background: #ff4757;
|
| 83 |
+
color: white;
|
| 84 |
+
border: none;
|
| 85 |
+
padding: 0.5rem 1rem;
|
| 86 |
+
border-radius: 8px;
|
| 87 |
+
cursor: pointer;
|
| 88 |
+
font-size: 0.875rem;
|
| 89 |
+
}
|
| 90 |
+
.header {
|
| 91 |
+
display: flex;
|
| 92 |
+
justify-content: space-between;
|
| 93 |
+
align-items: center;
|
| 94 |
+
margin-bottom: 1rem;
|
| 95 |
+
}
|
| 96 |
+
.anycoder-link {
|
| 97 |
+
color: #667eea;
|
| 98 |
+
text-decoration: none;
|
| 99 |
+
font-size: 0.875rem;
|
| 100 |
+
font-weight: 500;
|
| 101 |
+
}
|
| 102 |
+
@media (max-width: 480px) {
|
| 103 |
+
.container { padding: 1.5rem; }
|
| 104 |
+
.input-section { flex-direction: column; }
|
| 105 |
+
button { width: 100%; }
|
| 106 |
+
}
|
| 107 |
+
</style>
|
| 108 |
+
</head>
|
| 109 |
+
<body>
|
| 110 |
+
<div class="container">
|
| 111 |
+
<div class="header">
|
| 112 |
+
<h1>📝 Todo App</h1>
|
| 113 |
+
<a href="https://huggingface.co/spaces/akhaliq/anycoder" class="anycoder-link">Built with anycoder</a>
|
| 114 |
+
</div>
|
| 115 |
+
|
| 116 |
+
<div class="input-section">
|
| 117 |
+
<input type="text" id="todoInput" placeholder="Add a new task..." maxlength="100">
|
| 118 |
+
<button onclick="addTodo()">Add Task</button>
|
| 119 |
+
</div>
|
| 120 |
+
|
| 121 |
+
<div id="todoList"></div>
|
| 122 |
+
</div>
|
| 123 |
+
|
| 124 |
+
<script>
|
| 125 |
+
let todos = JSON.parse(localStorage.getItem('todos')) || [];
|
| 126 |
+
|
| 127 |
+
function renderTodos() {
|
| 128 |
+
const todoList = document.getElementById('todoList');
|
| 129 |
+
todoList.innerHTML = todos.map((todo, index) => `
|
| 130 |
+
<div class="todo-item ${todo.completed ? 'completed' : ''}">
|
| 131 |
+
<span class="todo-text">${todo.text}</span>
|
| 132 |
+
<button onclick="toggleTodo(${index})">${todo.completed ? 'Undo' : 'Done'}</button>
|
| 133 |
+
<button class="delete-btn" onclick="deleteTodo(${index})">Delete</button>
|
| 134 |
+
</div>
|
| 135 |
+
`).join('');
|
| 136 |
+
localStorage.setItem('todos', JSON.stringify(todos));
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
function addTodo() {
|
| 140 |
+
const input = document.getElementById('todoInput');
|
| 141 |
+
const text = input.value.trim();
|
| 142 |
+
if (text) {
|
| 143 |
+
todos.push({ text, completed: false });
|
| 144 |
+
input.value = '';
|
| 145 |
+
renderTodos();
|
| 146 |
+
}
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
function toggleTodo(index) {
|
| 150 |
+
todos[index].completed = !todos[index].completed;
|
| 151 |
+
renderTodos();
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
function deleteTodo(index) {
|
| 155 |
+
todos.splice(index, 1);
|
| 156 |
+
renderTodos();
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
document.getElementById('todoInput').addEventListener('keypress', (e) => {
|
| 160 |
+
if (e.key === 'Enter') addTodo();
|
| 161 |
+
});
|
| 162 |
+
|
| 163 |
+
renderTodos();
|
| 164 |
+
</script>
|
| 165 |
+
</body>
|
| 166 |
+
</html>
|