Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| 54506d376d |
2 changed files with 564 additions and 77 deletions
|
|
@ -3,11 +3,25 @@ const API_BASE = '/api/tasks';
|
||||||
const taskInput = document.getElementById('taskInput');
|
const taskInput = document.getElementById('taskInput');
|
||||||
const addBtn = document.getElementById('addBtn');
|
const addBtn = document.getElementById('addBtn');
|
||||||
const taskList = document.getElementById('taskList');
|
const taskList = document.getElementById('taskList');
|
||||||
|
const totalCount = document.getElementById('totalCount');
|
||||||
|
const pendingCount = document.getElementById('pendingCount');
|
||||||
|
const doneCount = document.getElementById('doneCount');
|
||||||
|
|
||||||
|
function updateStats(tasks) {
|
||||||
|
const total = tasks.length;
|
||||||
|
const done = tasks.filter(t => t.completed).length;
|
||||||
|
const pending = total - done;
|
||||||
|
|
||||||
|
totalCount.textContent = total;
|
||||||
|
pendingCount.textContent = pending;
|
||||||
|
doneCount.textContent = done;
|
||||||
|
}
|
||||||
|
|
||||||
async function fetchTasks() {
|
async function fetchTasks() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(API_BASE);
|
const response = await fetch(API_BASE);
|
||||||
const tasks = await response.json();
|
const tasks = await response.json();
|
||||||
|
updateStats(tasks);
|
||||||
renderTasks(tasks);
|
renderTasks(tasks);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching tasks:', error);
|
console.error('Error fetching tasks:', error);
|
||||||
|
|
@ -18,29 +32,64 @@ function renderTasks(tasks) {
|
||||||
taskList.innerHTML = '';
|
taskList.innerHTML = '';
|
||||||
|
|
||||||
if (tasks.length === 0) {
|
if (tasks.length === 0) {
|
||||||
taskList.innerHTML = '<div class="empty-state">No tasks yet. Add one above!</div>';
|
taskList.innerHTML = `
|
||||||
|
<div class="empty-state">
|
||||||
|
<span class="empty-icon">/</span>
|
||||||
|
no tasks yet
|
||||||
|
<div class="empty-hint">type above to add your first task</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.forEach(task => {
|
// Show pending tasks first, then completed
|
||||||
|
const sorted = [...tasks].sort((a, b) => {
|
||||||
|
if (a.completed !== b.completed) return a.completed ? 1 : -1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
sorted.forEach((task, index) => {
|
||||||
const li = document.createElement('li');
|
const li = document.createElement('li');
|
||||||
li.className = `task-item ${task.completed ? 'completed' : ''}`;
|
li.className = `task-item ${task.completed ? 'completed' : ''}`;
|
||||||
|
li.style.animationDelay = `${index * 0.04}s`;
|
||||||
|
|
||||||
|
const indexSpan = document.createElement('span');
|
||||||
|
indexSpan.className = 'task-index';
|
||||||
|
indexSpan.textContent = String(index + 1).padStart(2, '0');
|
||||||
|
|
||||||
|
const checkboxWrapper = document.createElement('label');
|
||||||
|
checkboxWrapper.className = 'checkbox-wrapper';
|
||||||
|
|
||||||
const checkbox = document.createElement('input');
|
const checkbox = document.createElement('input');
|
||||||
checkbox.type = 'checkbox';
|
checkbox.type = 'checkbox';
|
||||||
checkbox.checked = task.completed;
|
checkbox.checked = task.completed;
|
||||||
checkbox.addEventListener('change', () => toggleTask(task));
|
checkbox.addEventListener('change', () => toggleTask(task));
|
||||||
|
|
||||||
const span = document.createElement('span');
|
const checkboxCustom = document.createElement('span');
|
||||||
span.textContent = task.name;
|
checkboxCustom.className = 'checkbox-custom';
|
||||||
|
checkboxCustom.innerHTML = `<svg viewBox="0 0 12 12"><polyline points="2 6 5 9 10 3"></polyline></svg>`;
|
||||||
|
|
||||||
|
checkboxWrapper.appendChild(checkbox);
|
||||||
|
checkboxWrapper.appendChild(checkboxCustom);
|
||||||
|
|
||||||
|
const nameSpan = document.createElement('span');
|
||||||
|
nameSpan.className = 'task-name';
|
||||||
|
nameSpan.textContent = task.name;
|
||||||
|
|
||||||
const deleteBtn = document.createElement('button');
|
const deleteBtn = document.createElement('button');
|
||||||
deleteBtn.className = 'delete-btn';
|
deleteBtn.className = 'delete-btn';
|
||||||
deleteBtn.textContent = 'Delete';
|
deleteBtn.textContent = 'del';
|
||||||
deleteBtn.addEventListener('click', () => deleteTask(task.id));
|
deleteBtn.addEventListener('click', (e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
li.style.transition = 'all 0.3s ease';
|
||||||
|
li.style.opacity = '0';
|
||||||
|
li.style.transform = 'translateX(20px)';
|
||||||
|
setTimeout(() => deleteTask(task.id), 250);
|
||||||
|
});
|
||||||
|
|
||||||
li.appendChild(checkbox);
|
li.appendChild(indexSpan);
|
||||||
li.appendChild(span);
|
li.appendChild(checkboxWrapper);
|
||||||
|
li.appendChild(nameSpan);
|
||||||
li.appendChild(deleteBtn);
|
li.appendChild(deleteBtn);
|
||||||
taskList.appendChild(li);
|
taskList.appendChild(li);
|
||||||
});
|
});
|
||||||
|
|
@ -48,7 +97,13 @@ function renderTasks(tasks) {
|
||||||
|
|
||||||
async function addTask() {
|
async function addTask() {
|
||||||
const name = taskInput.value.trim();
|
const name = taskInput.value.trim();
|
||||||
if (!name) return;
|
if (!name) {
|
||||||
|
// Subtle shake on empty submit
|
||||||
|
taskInput.parentElement.style.animation = 'none';
|
||||||
|
taskInput.parentElement.offsetHeight; // reflow
|
||||||
|
taskInput.parentElement.style.animation = 'shake 0.4s ease';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(API_BASE, {
|
const response = await fetch(API_BASE, {
|
||||||
|
|
@ -103,6 +158,19 @@ async function deleteTask(id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add shake animation dynamically
|
||||||
|
const styleEl = document.createElement('style');
|
||||||
|
styleEl.textContent = `
|
||||||
|
@keyframes shake {
|
||||||
|
0%, 100% { transform: translateX(0); }
|
||||||
|
20% { transform: translateX(-4px); }
|
||||||
|
40% { transform: translateX(4px); }
|
||||||
|
60% { transform: translateX(-3px); }
|
||||||
|
80% { transform: translateX(2px); }
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
document.head.appendChild(styleEl);
|
||||||
|
|
||||||
addBtn.addEventListener('click', addTask);
|
addBtn.addEventListener('click', addTask);
|
||||||
taskInput.addEventListener('keypress', (e) => {
|
taskInput.addEventListener('keypress', (e) => {
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
|
|
@ -110,4 +178,9 @@ taskInput.addEventListener('keypress', (e) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Focus input on page load
|
||||||
|
window.addEventListener('load', () => {
|
||||||
|
taskInput.focus();
|
||||||
|
});
|
||||||
|
|
||||||
fetchTasks();
|
fetchTasks();
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,28 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Todo App</title>
|
<title>todo.</title>
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500&family=Instrument+Serif:ital@0;1&display=swap" rel="stylesheet">
|
||||||
<style>
|
<style>
|
||||||
|
:root {
|
||||||
|
--bg: #0a0a0a;
|
||||||
|
--surface: #141414;
|
||||||
|
--surface-hover: #1a1a1a;
|
||||||
|
--border: #222;
|
||||||
|
--border-accent: #333;
|
||||||
|
--text: #e8e8e8;
|
||||||
|
--text-muted: #666;
|
||||||
|
--text-dim: #444;
|
||||||
|
--accent: #c8ff00;
|
||||||
|
--accent-dim: rgba(200, 255, 0, 0.08);
|
||||||
|
--danger: #ff3b30;
|
||||||
|
--danger-dim: rgba(255, 59, 48, 0.1);
|
||||||
|
--mono: 'DM Mono', monospace;
|
||||||
|
--serif: 'Instrument Serif', serif;
|
||||||
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
@ -12,67 +32,223 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
font-family: var(--mono);
|
||||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
background: var(--bg);
|
||||||
|
color: var(--text);
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
overflow-x: hidden;
|
||||||
justify-content: center;
|
position: relative;
|
||||||
align-items: center;
|
|
||||||
padding: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
/* Grain overlay */
|
||||||
background: white;
|
body::before {
|
||||||
border-radius: 12px;
|
content: '';
|
||||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
opacity: 0.035;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 1000;
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
|
||||||
|
background-repeat: repeat;
|
||||||
|
background-size: 128px 128px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ambient glow */
|
||||||
|
.ambient-glow {
|
||||||
|
position: fixed;
|
||||||
|
width: 600px;
|
||||||
|
height: 600px;
|
||||||
|
border-radius: 50%;
|
||||||
|
filter: blur(200px);
|
||||||
|
opacity: 0.07;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.glow-1 {
|
||||||
|
top: -200px;
|
||||||
|
right: -100px;
|
||||||
|
background: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.glow-2 {
|
||||||
|
bottom: -300px;
|
||||||
|
left: -200px;
|
||||||
|
background: #ff3b30;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Layout */
|
||||||
|
.app {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
max-width: 720px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 60px 24px 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Header */
|
||||||
|
.header {
|
||||||
|
margin-bottom: 60px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-label {
|
||||||
|
font-size: 11px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.2em;
|
||||||
|
color: var(--text-muted);
|
||||||
|
margin-bottom: 12px;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-title {
|
||||||
|
font-family: var(--serif);
|
||||||
|
font-size: clamp(4rem, 12vw, 7rem);
|
||||||
|
font-weight: 400;
|
||||||
|
font-style: italic;
|
||||||
|
line-height: 0.85;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
color: var(--text);
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-title .dot {
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-rule {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 600px;
|
height: 1px;
|
||||||
padding: 40px;
|
background: var(--border);
|
||||||
|
margin-top: 24px;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
.header-rule::after {
|
||||||
color: #333;
|
content: '';
|
||||||
margin-bottom: 30px;
|
position: absolute;
|
||||||
text-align: center;
|
left: 0;
|
||||||
font-size: 2.5rem;
|
top: 0;
|
||||||
|
width: 80px;
|
||||||
|
height: 1px;
|
||||||
|
background: var(--accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-container {
|
/* Stats bar */
|
||||||
|
.stats {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 32px;
|
||||||
margin-bottom: 30px;
|
margin-top: 20px;
|
||||||
|
font-size: 11px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.15em;
|
||||||
|
color: var(--text-dim);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats span {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats .count {
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--text-muted);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats .accent-count {
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Input area */
|
||||||
|
.input-area {
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-wrapper {
|
||||||
|
display: flex;
|
||||||
|
align-items: stretch;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 2px;
|
||||||
|
background: var(--surface);
|
||||||
|
overflow: hidden;
|
||||||
|
transition: border-color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-wrapper:focus-within {
|
||||||
|
border-color: var(--accent);
|
||||||
|
box-shadow: 0 0 0 1px var(--accent), 0 0 40px rgba(200, 255, 0, 0.04);
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-prefix {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 16px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
font-size: 14px;
|
||||||
|
border-right: 1px solid var(--border);
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#taskInput {
|
#taskInput {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 12px 16px;
|
padding: 18px 20px;
|
||||||
border: 2px solid #e0e0e0;
|
background: transparent;
|
||||||
border-radius: 8px;
|
border: none;
|
||||||
font-size: 16px;
|
color: var(--text);
|
||||||
transition: border-color 0.3s;
|
font-family: var(--mono);
|
||||||
|
font-size: 14px;
|
||||||
|
outline: none;
|
||||||
|
font-weight: 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
#taskInput:focus {
|
#taskInput::placeholder {
|
||||||
outline: none;
|
color: var(--text-dim);
|
||||||
border-color: #667eea;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#addBtn {
|
#addBtn {
|
||||||
padding: 12px 24px;
|
padding: 18px 28px;
|
||||||
background: #667eea;
|
background: transparent;
|
||||||
color: white;
|
color: var(--accent);
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 8px;
|
border-left: 1px solid var(--border);
|
||||||
font-size: 16px;
|
font-family: var(--mono);
|
||||||
font-weight: 600;
|
font-size: 11px;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 0.15em;
|
||||||
|
text-transform: uppercase;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background 0.3s;
|
transition: all 0.2s ease;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
#addBtn:hover {
|
#addBtn:hover {
|
||||||
background: #5568d3;
|
background: var(--accent);
|
||||||
|
color: var(--bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Section label */
|
||||||
|
.section-label {
|
||||||
|
font-size: 10px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.25em;
|
||||||
|
color: var(--text-dim);
|
||||||
|
margin-bottom: 16px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-label::after {
|
||||||
|
content: '';
|
||||||
|
flex: 1;
|
||||||
|
height: 1px;
|
||||||
|
background: var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Task list */
|
||||||
#taskList {
|
#taskList {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
|
@ -80,72 +256,310 @@
|
||||||
.task-item {
|
.task-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 12px;
|
gap: 16px;
|
||||||
padding: 16px;
|
padding: 16px 20px;
|
||||||
background: #f8f9fa;
|
border: 1px solid transparent;
|
||||||
border-radius: 8px;
|
border-bottom: 1px solid var(--border);
|
||||||
margin-bottom: 12px;
|
cursor: default;
|
||||||
transition: all 0.3s;
|
transition: all 0.2s ease;
|
||||||
|
position: relative;
|
||||||
|
animation: taskSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-item:first-child {
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-item:hover {
|
.task-item:hover {
|
||||||
background: #e9ecef;
|
background: var(--surface);
|
||||||
transform: translateY(-2px);
|
border-color: var(--border);
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-item.completed {
|
.task-item:hover .task-index {
|
||||||
opacity: 0.6;
|
color: var(--accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-item input[type="checkbox"] {
|
/* Task index number */
|
||||||
|
.task-index {
|
||||||
|
font-size: 10px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
min-width: 20px;
|
||||||
|
font-weight: 500;
|
||||||
|
transition: color 0.2s ease;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Custom checkbox */
|
||||||
|
.checkbox-wrapper {
|
||||||
|
position: relative;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
cursor: pointer;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-item span {
|
.checkbox-wrapper input {
|
||||||
|
position: absolute;
|
||||||
|
opacity: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-custom {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
border: 1.5px solid var(--border-accent);
|
||||||
|
border-radius: 2px;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-wrapper input:hover + .checkbox-custom {
|
||||||
|
border-color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-wrapper input:checked + .checkbox-custom {
|
||||||
|
border-color: var(--accent);
|
||||||
|
background: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-custom svg {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-wrapper input:checked + .checkbox-custom svg {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-custom svg polyline {
|
||||||
|
stroke: var(--bg);
|
||||||
|
stroke-width: 2.5;
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
fill: none;
|
||||||
|
stroke-dasharray: 20;
|
||||||
|
stroke-dashoffset: 20;
|
||||||
|
transition: stroke-dashoffset 0.3s ease 0.1s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-wrapper input:checked + .checkbox-custom svg polyline {
|
||||||
|
stroke-dashoffset: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Task text */
|
||||||
|
.task-name {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
font-size: 16px;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.task-item.completed span {
|
|
||||||
text-decoration: line-through;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.delete-btn {
|
|
||||||
padding: 8px 16px;
|
|
||||||
background: #dc3545;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
border-radius: 6px;
|
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text);
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-item.completed .task-name {
|
||||||
|
color: var(--text-dim);
|
||||||
|
text-decoration: line-through;
|
||||||
|
text-decoration-color: var(--text-dim);
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-item.completed .task-index {
|
||||||
|
color: var(--text-dim);
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Delete button */
|
||||||
|
.delete-btn {
|
||||||
|
opacity: 0;
|
||||||
|
padding: 6px 12px;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--danger);
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 2px;
|
||||||
|
font-family: var(--mono);
|
||||||
|
font-size: 10px;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
text-transform: uppercase;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background 0.3s;
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-item:hover .delete-btn {
|
||||||
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.delete-btn:hover {
|
.delete-btn:hover {
|
||||||
background: #c82333;
|
background: var(--danger-dim);
|
||||||
|
border-color: var(--danger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Task slide in animation */
|
||||||
|
@keyframes taskSlideIn {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(8px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Empty state */
|
||||||
.empty-state {
|
.empty-state {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #999;
|
padding: 80px 40px;
|
||||||
padding: 40px;
|
color: var(--text-dim);
|
||||||
font-size: 18px;
|
font-size: 13px;
|
||||||
|
font-weight: 300;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state .empty-icon {
|
||||||
|
font-size: 32px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
opacity: 0.3;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state .empty-hint {
|
||||||
|
margin-top: 8px;
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Keyboard hint */
|
||||||
|
.keyboard-hint {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 24px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
font-size: 10px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
letter-spacing: 0.15em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
opacity: 0.4;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kbd {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 2px 7px;
|
||||||
|
background: var(--surface);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 3px;
|
||||||
|
font-size: 10px;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Page load animation */
|
||||||
|
.app {
|
||||||
|
animation: pageIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pageIn {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(20px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scrollbar */
|
||||||
|
::-webkit-scrollbar {
|
||||||
|
width: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-track {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-thumb {
|
||||||
|
background: var(--border);
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-thumb:hover {
|
||||||
|
background: var(--border-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Selection */
|
||||||
|
::selection {
|
||||||
|
background: var(--accent);
|
||||||
|
color: var(--bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Responsive */
|
||||||
|
@media (max-width: 540px) {
|
||||||
|
.app {
|
||||||
|
padding: 40px 16px 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-title {
|
||||||
|
font-size: 3.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats {
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-prefix {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.keyboard-hint {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="ambient-glow glow-1"></div>
|
||||||
<h1>Todo List</h1>
|
<div class="ambient-glow glow-2"></div>
|
||||||
<div class="input-container">
|
|
||||||
<input type="text" id="taskInput" placeholder="Add a new task..." />
|
<div class="app">
|
||||||
<button id="addBtn">Add Task</button>
|
<header class="header">
|
||||||
|
<div class="header-label">task manager</div>
|
||||||
|
<h1 class="header-title">todo<span class="dot">.</span></h1>
|
||||||
|
<div class="header-rule"></div>
|
||||||
|
<div class="stats">
|
||||||
|
<span><span class="count accent-count" id="totalCount">0</span> total</span>
|
||||||
|
<span><span class="count" id="pendingCount">0</span> pending</span>
|
||||||
|
<span><span class="count" id="doneCount">0</span> done</span>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="input-area">
|
||||||
|
<div class="input-wrapper">
|
||||||
|
<div class="input-prefix">+</div>
|
||||||
|
<input type="text" id="taskInput" placeholder="what needs to be done?" autocomplete="off" spellcheck="false" />
|
||||||
|
<button id="addBtn">Add</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="section-label">Tasks</div>
|
||||||
<ul id="taskList"></ul>
|
<ul id="taskList"></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="keyboard-hint">
|
||||||
|
press <span class="kbd">Enter</span> to add
|
||||||
|
</div>
|
||||||
|
|
||||||
<script src="app.js"></script>
|
<script src="app.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue