1
0
Fork 0
claude-code-first-project/examples/index.html
Kjell Tore Guttormsen b06b39c0e7 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>
2026-03-15 16:27:23 +01:00

346 lines
9.9 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<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>
: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: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
background: var(--bg);
color: var(--text);
min-height: 100vh;
display: flex;
justify-content: center;
padding: 4rem 1.5rem 2rem;
background-image: radial-gradient(ellipse at 50% 0%, #1E1D1A 0%, var(--bg) 70%);
}
.container {
width: 100%;
max-width: 480px;
}
header {
margin-bottom: 2rem;
}
h1 {
font-size: 1.5rem;
font-weight: 700;
letter-spacing: -0.03em;
color: var(--text);
}
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: 2rem;
position: relative;
}
.input-area input {
flex: 1;
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, box-shadow 0.2s;
}
.input-area input:focus {
border-color: var(--border-focus);
box-shadow: 0 0 0 3px rgba(232, 168, 124, 0.1);
}
.input-area input::placeholder {
color: var(--text-faint);
}
.input-area button {
padding: 0 1.25rem;
background: var(--accent);
color: var(--accent-text);
border: none;
border-radius: var(--radius);
font-family: inherit;
font-size: 0.875rem;
font-weight: 600;
cursor: pointer;
transition: background 0.15s, transform 0.1s;
white-space: nowrap;
}
.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.875rem;
padding: 0.875rem 1rem;
background: var(--surface);
border-radius: var(--radius-sm);
transition: background 0.15s;
animation: fadeUp 0.25s ease both;
}
.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);
}
@keyframes fadeUp {
from { opacity: 0; transform: translateY(6px); }
to { opacity: 1; transform: translateY(0); }
}
.checkbox {
width: 20px;
height: 20px;
border: 1.5px solid var(--text-faint);
border-radius: 6px;
cursor: pointer;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
}
.checkbox:hover {
border-color: var(--check);
}
.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.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: var(--text-faint);
cursor: pointer;
padding: 0.25rem;
font-size: 1rem;
line-height: 1;
transition: opacity 0.15s, color 0.15s;
flex-shrink: 0;
}
.task-item:hover .delete-btn {
opacity: 1;
}
.delete-btn:hover {
color: var(--danger);
}
.empty-state {
text-align: center;
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 {
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">
<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="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));
}
function renderTasks() {
const list = document.getElementById('taskList');
const countEl = document.getElementById('taskCount');
if (tasks.length === 0) {
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' : ''}" 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})" aria-label="Delete">&times;</button>
</li>
`).join('');
const active = tasks.filter(t => !t.completed).length;
const total = tasks.length;
countEl.textContent = active === 0 ? 'All done' : `${active} of ${total} remaining`;
}
function addTask() {
const input = document.getElementById('taskInput');
const text = input.value.trim();
if (!text) return;
tasks.unshift({ text, completed: false, id: Date.now() });
input.value = '';
saveTasks();
renderTasks();
input.focus();
}
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(i) {
tasks.splice(i, 1);
saveTasks();
renderTasks();
}
function escapeHtml(t) {
const d = document.createElement('div');
d.textContent = t;
return d.innerHTML;
}
document.getElementById('taskInput').addEventListener('keydown', e => {
if (e.key === 'Enter') addTask();
});
renderTasks();
</script>
</body>
</html>