redesign: warm stone aesthetic for todo app examples
Replace cold navy/teal palette with warm dark theme: - Warm near-black backgrounds, copper/peach accent - Sage green for completion, muted category colors - Plus Jakarta Sans typography - Refined micro-interactions and hover states - Grouped card layout with staggered animation - Completed tasks auto-sort to bottom Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9a490f129a
commit
b06b39c0e7
2 changed files with 511 additions and 286 deletions
|
|
@ -3,186 +3,278 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<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 href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
:root {
|
||||
--bg: #111110;
|
||||
--surface: #1C1C1A;
|
||||
--surface-hover: #232320;
|
||||
--border: #2E2E2A;
|
||||
--border-focus: #E8A87C;
|
||||
--text: #E8E4DF;
|
||||
--text-muted: #8A8580;
|
||||
--text-faint: #5A5750;
|
||||
--accent: #E8A87C;
|
||||
--accent-hover: #D4926A;
|
||||
--accent-text: #1C1C1A;
|
||||
--check: #7FB88F;
|
||||
--danger: #C96B5E;
|
||||
--radius: 10px;
|
||||
--radius-sm: 7px;
|
||||
}
|
||||
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
background: #1a1a2e;
|
||||
color: #e0e0e0;
|
||||
font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 2rem 1rem;
|
||||
padding: 4rem 1.5rem 2rem;
|
||||
background-image: radial-gradient(ellipse at 50% 0%, #1E1D1A 0%, var(--bg) 70%);
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
max-width: 540px;
|
||||
max-width: 480px;
|
||||
}
|
||||
|
||||
header {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.75rem;
|
||||
font-weight: 600;
|
||||
margin-bottom: 1.5rem;
|
||||
color: #ffffff;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.03em;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.input-row {
|
||||
h1 span {
|
||||
color: var(--text-faint);
|
||||
font-weight: 400;
|
||||
font-size: 0.875rem;
|
||||
margin-left: 0.5rem;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
.input-area {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
margin-bottom: 1.5rem;
|
||||
margin-bottom: 2rem;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.input-row input {
|
||||
.input-area input {
|
||||
flex: 1;
|
||||
padding: 0.75rem 1rem;
|
||||
background: #16213e;
|
||||
border: 1px solid #2a2a4a;
|
||||
border-radius: 8px;
|
||||
color: #e0e0e0;
|
||||
font-size: 1rem;
|
||||
padding: 0.8125rem 1rem;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
color: var(--text);
|
||||
font-family: inherit;
|
||||
font-size: 0.9375rem;
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.input-row input:focus {
|
||||
border-color: #4DB8A4;
|
||||
.input-area input:focus {
|
||||
border-color: var(--border-focus);
|
||||
box-shadow: 0 0 0 3px rgba(232, 168, 124, 0.1);
|
||||
}
|
||||
|
||||
.input-row input::placeholder {
|
||||
color: #666;
|
||||
.input-area input::placeholder {
|
||||
color: var(--text-faint);
|
||||
}
|
||||
|
||||
.input-row button {
|
||||
padding: 0.75rem 1.25rem;
|
||||
background: #4DB8A4;
|
||||
color: #1a1a2e;
|
||||
.input-area button {
|
||||
padding: 0 1.25rem;
|
||||
background: var(--accent);
|
||||
color: var(--accent-text);
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-size: 1rem;
|
||||
border-radius: var(--radius);
|
||||
font-family: inherit;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s;
|
||||
transition: background 0.15s, transform 0.1s;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.input-row button:hover {
|
||||
background: #3da897;
|
||||
.input-area button:hover {
|
||||
background: var(--accent-hover);
|
||||
}
|
||||
|
||||
.input-area button:active {
|
||||
transform: scale(0.97);
|
||||
}
|
||||
|
||||
.task-list {
|
||||
list-style: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.task-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
gap: 0.875rem;
|
||||
padding: 0.875rem 1rem;
|
||||
background: #16213e;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 0.5rem;
|
||||
transition: opacity 0.3s, transform 0.3s;
|
||||
animation: slideIn 0.3s ease;
|
||||
background: var(--surface);
|
||||
border-radius: var(--radius-sm);
|
||||
transition: background 0.15s;
|
||||
animation: fadeUp 0.25s ease both;
|
||||
}
|
||||
|
||||
@keyframes slideIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
.task-item:first-child { border-radius: var(--radius) var(--radius) var(--radius-sm) var(--radius-sm); }
|
||||
.task-item:last-child { border-radius: var(--radius-sm) var(--radius-sm) var(--radius) var(--radius); }
|
||||
.task-item:only-child { border-radius: var(--radius); }
|
||||
|
||||
.task-item:hover {
|
||||
background: var(--surface-hover);
|
||||
}
|
||||
|
||||
.task-item.completed .task-text {
|
||||
text-decoration: line-through;
|
||||
color: #555;
|
||||
@keyframes fadeUp {
|
||||
from { opacity: 0; transform: translateY(6px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
.task-checkbox {
|
||||
.checkbox {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border: 2px solid #4DB8A4;
|
||||
border-radius: 50%;
|
||||
border: 1.5px solid var(--text-faint);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
transition: background 0.2s;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.task-item.completed .task-checkbox {
|
||||
background: #4DB8A4;
|
||||
.checkbox:hover {
|
||||
border-color: var(--check);
|
||||
}
|
||||
|
||||
.task-item.completed .task-checkbox::after {
|
||||
content: '\2713';
|
||||
color: #1a1a2e;
|
||||
font-size: 0.75rem;
|
||||
font-weight: bold;
|
||||
.task-item.completed .checkbox {
|
||||
background: var(--check);
|
||||
border-color: var(--check);
|
||||
}
|
||||
|
||||
.checkbox svg {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s;
|
||||
}
|
||||
|
||||
.task-item.completed .checkbox svg {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.task-text {
|
||||
flex: 1;
|
||||
font-size: 0.95rem;
|
||||
line-height: 1.4;
|
||||
font-size: 0.9375rem;
|
||||
line-height: 1.45;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
.task-item.completed .task-text {
|
||||
color: var(--text-faint);
|
||||
text-decoration: line-through;
|
||||
text-decoration-color: var(--text-faint);
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
opacity: 0;
|
||||
background: none;
|
||||
border: none;
|
||||
color: #555;
|
||||
color: var(--text-faint);
|
||||
cursor: pointer;
|
||||
font-size: 1.25rem;
|
||||
padding: 0.25rem;
|
||||
font-size: 1rem;
|
||||
line-height: 1;
|
||||
transition: color 0.2s;
|
||||
transition: opacity 0.15s, color 0.15s;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.task-item:hover .delete-btn {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.delete-btn:hover {
|
||||
color: #e74c3c;
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
color: #555;
|
||||
padding: 2rem;
|
||||
font-size: 0.95rem;
|
||||
padding: 3rem 1rem;
|
||||
color: var(--text-faint);
|
||||
font-size: 0.9375rem;
|
||||
}
|
||||
|
||||
.empty-state::before {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
margin: 0 auto 1rem;
|
||||
border: 2px dashed var(--border);
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 1rem;
|
||||
padding: 0 0.25rem;
|
||||
}
|
||||
|
||||
.task-count {
|
||||
text-align: center;
|
||||
color: #555;
|
||||
font-size: 0.8rem;
|
||||
margin-top: 1rem;
|
||||
color: var(--text-faint);
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
body { padding: 2rem 1rem; }
|
||||
.task-item { padding: 0.75rem; gap: 0.75rem; }
|
||||
.delete-btn { opacity: 0.5; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Todo</h1>
|
||||
<div class="input-row">
|
||||
<input type="text" id="taskInput" placeholder="What needs to be done?" autofocus>
|
||||
<header>
|
||||
<h1>Todo <span id="dateDisplay"></span></h1>
|
||||
</header>
|
||||
|
||||
<div class="input-area">
|
||||
<input type="text" id="taskInput" placeholder="Add a new task..." autofocus>
|
||||
<button onclick="addTask()">Add</button>
|
||||
</div>
|
||||
|
||||
<ul class="task-list" id="taskList"></ul>
|
||||
<div class="task-count" id="taskCount"></div>
|
||||
|
||||
<div class="footer">
|
||||
<div class="task-count" id="taskCount"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const checkSvg = '<svg viewBox="0 0 12 12" fill="none" stroke="#1C1C1A" stroke-width="2" stroke-linecap="round"><polyline points="2.5,6 5,8.5 9.5,3.5"/></svg>';
|
||||
let tasks = JSON.parse(localStorage.getItem('todos') || '[]');
|
||||
|
||||
// Show today's date
|
||||
const d = new Date();
|
||||
document.getElementById('dateDisplay').textContent =
|
||||
d.toLocaleDateString('en-US', { weekday: 'long', month: 'short', day: 'numeric' });
|
||||
|
||||
function saveTasks() {
|
||||
localStorage.setItem('todos', JSON.stringify(tasks));
|
||||
}
|
||||
|
|
@ -192,21 +284,22 @@
|
|||
const countEl = document.getElementById('taskCount');
|
||||
|
||||
if (tasks.length === 0) {
|
||||
list.innerHTML = '<li class="empty-state">No tasks yet. Add one above.</li>';
|
||||
list.innerHTML = '<li class="empty-state">No tasks yet</li>';
|
||||
countEl.textContent = '';
|
||||
return;
|
||||
}
|
||||
|
||||
list.innerHTML = tasks.map((task, i) => `
|
||||
<li class="task-item ${task.completed ? 'completed' : ''}">
|
||||
<div class="task-checkbox" onclick="toggleTask(${i})"></div>
|
||||
<li class="task-item ${task.completed ? 'completed' : ''}" style="animation-delay:${i * 30}ms">
|
||||
<div class="checkbox" onclick="toggleTask(${i})">${checkSvg}</div>
|
||||
<span class="task-text">${escapeHtml(task.text)}</span>
|
||||
<button class="delete-btn" onclick="deleteTask(${i})" title="Delete">×</button>
|
||||
<button class="delete-btn" onclick="deleteTask(${i})" aria-label="Delete">×</button>
|
||||
</li>
|
||||
`).join('');
|
||||
|
||||
const active = tasks.filter(t => !t.completed).length;
|
||||
countEl.textContent = `${active} task${active !== 1 ? 's' : ''} remaining`;
|
||||
const total = tasks.length;
|
||||
countEl.textContent = active === 0 ? 'All done' : `${active} of ${total} remaining`;
|
||||
}
|
||||
|
||||
function addTask() {
|
||||
|
|
@ -218,27 +311,32 @@
|
|||
input.value = '';
|
||||
saveTasks();
|
||||
renderTasks();
|
||||
input.focus();
|
||||
}
|
||||
|
||||
function toggleTask(index) {
|
||||
tasks[index].completed = !tasks[index].completed;
|
||||
function toggleTask(i) {
|
||||
tasks[i].completed = !tasks[i].completed;
|
||||
// Move completed to bottom
|
||||
const task = tasks.splice(i, 1)[0];
|
||||
if (task.completed) tasks.push(task);
|
||||
else tasks.unshift(task);
|
||||
saveTasks();
|
||||
renderTasks();
|
||||
}
|
||||
|
||||
function deleteTask(index) {
|
||||
tasks.splice(index, 1);
|
||||
function deleteTask(i) {
|
||||
tasks.splice(i, 1);
|
||||
saveTasks();
|
||||
renderTasks();
|
||||
}
|
||||
|
||||
function escapeHtml(text) {
|
||||
const div = document.createElement('div');
|
||||
div.textContent = text;
|
||||
return div.innerHTML;
|
||||
function escapeHtml(t) {
|
||||
const d = document.createElement('div');
|
||||
d.textContent = t;
|
||||
return d.innerHTML;
|
||||
}
|
||||
|
||||
document.getElementById('taskInput').addEventListener('keypress', (e) => {
|
||||
document.getElementById('taskInput').addEventListener('keydown', e => {
|
||||
if (e.key === 'Enter') addTask();
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue