dark-todo-app / index.html
dolordprince
deploy: dark-todo-app
5c815b2
Raw
History Blame Contribute Delete
4.25 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dark Todo App</title>
<style>
body {
background-color: #2f2f2f;
color: #ffffff;
font-family: Arial, sans-serif;
}
.todo-container {
width: 500px;
margin: 40px auto;
padding: 20px;
background-color: #444444;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}
.todo-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.todo-input {
width: 100%;
padding: 10px;
font-size: 16px;
border: none;
border-radius: 5px;
background-color: #555555;
color: #ffffff;
}
.todo-input:focus {
outline: none;
border: 1px solid #777777;
}
.todo-btn {
padding: 10px 20px;
font-size: 16px;
border: none;
border-radius: 5px;
background-color: #666666;
color: #ffffff;
cursor: pointer;
}
.todo-btn:hover {
background-color: #777777;
}
.todo-list {
list-style: none;
padding: 0;
margin: 0;
}
.todo-item {
padding: 10px;
border-bottom: 1px solid #555555;
}
.todo-item:last-child {
border-bottom: none;
}
.todo-item.completed {
text-decoration: line-through;
color: #777777;
}
.todo-item.completed .todo-remove {
display: block;
}
.todo-remove {
display: none;
float: right;
padding: 5px;
font-size: 16px;
cursor: pointer;
}
.todo-remove:hover {
color: #ff0000;
}
.dolor3v-branding {
position: fixed;
bottom: 10px;
right: 10px;
font-size: 12px;
color: #777777;
}
</style>
</head>
<body>
<div class="todo-container">
<div class="todo-header">
<h2>Dark Todo App</h2>
<input type="text" id="todo-input" class="todo-input" placeholder="Add new task">
<button class="todo-btn" id="todo-add">Add</button>
</div>
<ul class="todo-list" id="todo-list"></ul>
</div>
<div class="dolor3v-branding">Created by <a href="https://github.com/dolordprince" target="_blank">dolordprince</a> | Version: 2.0.0</div>
<script>
const todoList = document.getElementById('todo-list');
const todoInput = document.getElementById('todo-input');
const todoAdd = document.getElementById('todo-add');
let tasks = [];
todoAdd.addEventListener('click', addTask);
function addTask() {
const task = todoInput.value.trim();
if (task) {
tasks.push({ text: task, completed: false });
renderTasks();
todoInput.value = '';
}
}
function renderTasks() {
todoList.innerHTML = '';
tasks.forEach((task, index) => {
const taskHtml = `
<li class="todo-item ${task.completed ? 'completed' : ''}">
${task.text}
<span class="todo-remove" onclick="removeTask(${index})">&#10005;</span>
<input type="checkbox" onclick="toggleCompleted(${index})" ${task.completed ? 'checked' : ''}>
</li>
`;
todoList.insertAdjacentHTML('beforeend', taskHtml);
});
}
function removeTask(index) {
tasks.splice(index, 1);
renderTasks();
}
function toggleCompleted(index) {
tasks[index].completed = !tasks[index].completed;
renderTasks();
}
</script>
</body>
</html>