From 95ee9857f26fb6898982c24543f570850e3e31e2 Mon Sep 17 00:00:00 2001 From: Daijeyung Date: Fri, 5 Dec 2025 18:50:52 +0000 Subject: [PATCH] Create TodoApp component for managing tasks TodoApp is a simple and efficient task-management tool designed to help users stay organized and productive. With its clean, modern interface and responsive design, TodoApp makes it easy to add tasks, mark them as complete, and delete them when no longer needed. Built with smooth animations and intuitive controls, TodoApp delivers a user-friendly experience perfect for managing daily routines, work responsibilities, personal goals, or long-term projects. Key Features Add new tasks with a single click Mark tasks as complete with a simple tap Delete tasks instantly Smooth transition animations powered by Framer Motion Modern design using shadcn UI components Fully responsive layout for all screen sizes Whether you're tracking small reminders or planning your whole day, TodoApp keeps your workflow organized and stress-free. --- denam host | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 denam host diff --git a/denam host b/denam host new file mode 100644 index 0000000..64181e9 --- /dev/null +++ b/denam host @@ -0,0 +1,83 @@ +import React, { useState, useEffect } from "react"; + +export default function TodoApp() { + const [todos, setTodos] = useState(() => + JSON.parse(localStorage.getItem("todos") || "[]") + ); + const [input, setInput] = useState(""); + + // Save todos to localStorage whenever they change + useEffect(() => { + localStorage.setItem("todos", JSON.stringify(todos)); + }, [todos]); + + const addTodo = (e) => { + e.preventDefault(); + if (!input.trim()) return; + setTodos([...todos, { id: Date.now(), text: input, done: false }]); + setInput(""); + }; + + const toggleTodo = (id) => { + setTodos(todos => + todos.map(todo => + todo.id === id ? { ...todo, done: !todo.done } : todo + ) + ); + }; + + const deleteTodo = (id) => { + setTodos(todos => todos.filter(todo => todo.id !== id)); + }; + + return ( +
+
+

To-Do List

+
+ setInput(e.target.value)} + placeholder="What needs to be done?" + autoFocus + /> + +
+
    + {todos.length === 0 ? ( +
  • No tasks yet.
  • + ) : ( + todos.map(todo => ( +
  • + + +
  • + )) + )} +
+
+
+ ); +}