diff --git a/src/App.tsx b/src/App.tsx
index 9d18e93..973573a 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,7 +1,26 @@
+import { BrowserRouter, Routes, Route, Navigate } from "react-router-dom";
+
+import TodoList from "./containers/TodoList/TodoList"
+import NewTodo from "./containers/TodoList/NewTodo/NewTodo"
+import TodoDetail from "./components/TodoDetail/TodoDetail"
+
import "./App.css";
function App() {
- return
;
+ return (
+
+
+
+ } />
+ } />
+ {/* } /> */}
+
+ } />
+ Not Found} />
+
+
+
+ );
}
-export default App;
+export default App;
\ No newline at end of file
diff --git a/src/components/Todo/Todo.tsx b/src/components/Todo/Todo.tsx
index cb0ff5c..b4b2abe 100644
--- a/src/components/Todo/Todo.tsx
+++ b/src/components/Todo/Todo.tsx
@@ -1 +1,20 @@
-export {};
+import "./Todo.css";
+
+interface IProps {
+ title: string;
+ clicked?: React.MouseEventHandler; // Defined by React
+ done: boolean;
+}
+
+const Todo = (props: IProps) => {
+ return (
+
+
+ {props.title}
+
+ {props.done &&
✓
}
+
+ );
+};
+export default Todo;
+
\ No newline at end of file
diff --git a/src/components/TodoDetail/TodoDetail.tsx b/src/components/TodoDetail/TodoDetail.tsx
index cb0ff5c..971b633 100644
--- a/src/components/TodoDetail/TodoDetail.tsx
+++ b/src/components/TodoDetail/TodoDetail.tsx
@@ -1 +1,24 @@
-export {};
+import "./TodoDetail.css"
+
+type Props = {
+ title: string;
+ content: string;
+};
+
+const TodoDetail = (props: Props) => {
+ return (
+
+
+
Name:
+
{props.title}
+
+
+
+
Content:
+
{props.content}
+
+
+ );
+}
+
+export default TodoDetail;
diff --git a/src/containers/TodoList/NewTodo/NewTodo.tsx b/src/containers/TodoList/NewTodo/NewTodo.tsx
index cb0ff5c..9c85670 100644
--- a/src/containers/TodoList/NewTodo/NewTodo.tsx
+++ b/src/containers/TodoList/NewTodo/NewTodo.tsx
@@ -1 +1,36 @@
-export {};
+import { useState } from "react";
+import { Navigate } from "react-router-dom";
+import "./NewTodo.css";
+
+const NewTodo = () => {
+ const [title, setTitle] = useState("");
+ const [content, setContent] = useState("");
+ const [submitted, setSubmitted] = useState(false);
+
+ const postTodoHandler = () => {
+ const data = { title: title, content: content };
+
+ alert("Submitted\n" + data.title + "\n" + data.content);
+ setSubmitted(true);
+ };
+
+ return submitted ? : (
+
+
Add a Todo
+
+
+ setTitle(event.target.value)}/>
+
+
+
+ );
+}
+
+export default NewTodo;
diff --git a/src/containers/TodoList/TodoList.tsx b/src/containers/TodoList/TodoList.tsx
index cb0ff5c..1bd56df 100644
--- a/src/containers/TodoList/TodoList.tsx
+++ b/src/containers/TodoList/TodoList.tsx
@@ -1 +1,51 @@
-export {};
+import { render } from "@testing-library/react";
+import { useState, useMemo } from "react";
+import { Link, NavLink } from "react-router-dom";
+
+import Todo from "../../components/Todo/Todo";
+import TodoDetail from "../../components/TodoDetail/TodoDetail";
+
+import "./TodoList.css";
+
+interface IProps {
+ title: string;
+}
+
+type TodoType = { id: number; title: string; content: string; done: boolean;};
+
+const TodoList = (props: IProps) => {
+ const { title } = props;
+ const [todos, setTodos] = useState([
+ { id: 1, title: "SWPP", content: "take swpp class", done: true },
+ { id: 2, title: "Movie", content: "watch movie", done: false },
+ { id: 3, title: "Dinner", content: "eat dinner", done: false },
+ ]);
+
+ const [selectedTodo, setSelectedTodo] = useState(null);
+ const clickTodoHandler = (todo: TodoType) => {
+ setSelectedTodo(selectedTodo === todo ? null : todo)
+ };
+
+ const todoDetail = useMemo(() => {
+ return selectedTodo ? (
+
+ ) : null;
+ }, [selectedTodo]);
+
+ return (
+
+
{title}
+
+ {todos.map((td) => {
+ return clickTodoHandler(td)}/>;
+ })}
+
+ {todoDetail}
+
+ New Todo
+
+
+
);
+}
+
+export default TodoList;
\ No newline at end of file