完成TODO List

This commit is contained in:
Kagura 2024-11-21 22:08:57 +08:00
parent da309a44d4
commit 4c6c668a3e

View file

@ -16,6 +16,14 @@ function TodoItems({ items, setItems }: {
items: todoItem[], items: todoItem[],
setItems: React.Dispatch<React.SetStateAction<todoItem[]>> setItems: React.Dispatch<React.SetStateAction<todoItem[]>>
}) { }) {
if (items.length == 0){ // 空
return (
<div className="text-center text-xl space-y-2 text-teal-800">
<p>TODO项目</p>
<p> TODO</p>
</div>
)}
return ( return (
<> <>
<ul className="space-y-4"> <ul className="space-y-4">
@ -111,7 +119,7 @@ const TodoList = () => {
return ( return (
<div className="min-h-screen flex flex-col items-center justify-center bg-slate-50 p-2 sm:p-4"> <div className="min-h-screen flex flex-col items-center justify-center bg-slate-50 p-2 sm:p-4">
<p className="text-2xl sm:text-4xl text-center p-5 sm:p-20 bg-gradient-to-r from-blue-800 to-pink-800 via-green-950 inline-block text-transparent bg-clip-text">TODO</p> <p className="text-2xl sm:text-4xl text-center p-5 sm:p-20 bg-gradient-to-r from-blue-600 to-pink-600 via-green-700 inline-block text-transparent bg-clip-text">TODO</p>
<div className="w-full sm:max-w-3xl p-5 sm:p-10 bg-white rounded-lg shadow-lg"> <div className="w-full sm:max-w-3xl p-5 sm:p-10 bg-white rounded-lg shadow-lg">
<TodoItems items={items} setItems={setItems} /> <TodoItems items={items} setItems={setItems} />
</div> </div>