diff --git a/src/App.tsx b/src/App.tsx index 9d18e93..002bad0 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,7 +1,19 @@ import "./App.css"; +import TodoList from "./containers/TodoList/TodoList"; +import {BrowserRouter, Routes, Route, Navigate} from "react-router-dom"; +import NewTodo from "./containers/TodoList/NewTodo/NewTodo" function App() { - return
; + return (
+ + + }/> + }/> + }/> + Not Found}/> + + +
); } export default App; diff --git a/src/components/Todo/Todo.tsx b/src/components/Todo/Todo.tsx index cb0ff5c..667a617 100644 --- a/src/components/Todo/Todo.tsx +++ b/src/components/Todo/Todo.tsx @@ -1 +1,20 @@ -export {}; +import "../../containers/TodoList/TodoList.css" +import "./Todo.css" + +interface IProps{ + title: string; + clicked?: React.MouseEventHandler; + done:boolean; +} + +const Todo = (props: IProps)=>{ + return ( +
+
+ {props.title} +
+ {props.done &&
} +
+ ); +}; +export default Todo; diff --git a/src/components/TodoDetail/TodoDetail.tsx b/src/components/TodoDetail/TodoDetail.tsx index cb0ff5c..6166825 100644 --- a/src/components/TodoDetail/TodoDetail.tsx +++ b/src/components/TodoDetail/TodoDetail.tsx @@ -1 +1,25 @@ -export {}; +import "./TodoDetail.css"; + +type Props={ + title:string; + content:string; +} + +const TodoDetail = (props: Props)=>{ + return( +
+
+
Name:
+
{props.title}
+
+
+
Content:
+
+ {props.content} +
+
+
+ ); +}; + +export default TodoDetail; \ No newline at end of file diff --git a/src/containers/TodoList/NewTodo/NewTodo.tsx b/src/containers/TodoList/NewTodo/NewTodo.tsx index cb0ff5c..1919a74 100644 --- a/src/containers/TodoList/NewTodo/NewTodo.tsx +++ b/src/containers/TodoList/NewTodo/NewTodo.tsx @@ -1 +1,43 @@ -export {}; +import {useState} from "react"; +import "./NewTodo.css"; +import {useNavigate, Navigate } from "react-router-dom"; + +export default function NewTodo(){ + const[title,setTitle]=useState(""); + const [content,setContent]=useState(""); + const [submitted,setSubmitted]=useState(false); + const navigate = useNavigate(); + const postTodoHandler = () => { + const data = { title: title, content: content }; + alert("Submitted\n" + data.title + "\n" + data.content); + setSubmitted(true); + }; + + if(submitted){ + return + } + else{ + return ( +
+

Add a Todo

+ + setTitle(event.target.value) + } + /> + +