From a2d68bca0999b6fe1d4b4c27cbabdd951424ebb2 Mon Sep 17 00:00:00 2001 From: James McKenzie Date: Tue, 27 Apr 2021 16:33:16 +1200 Subject: [PATCH] Moved the types out into their own type files --- ReactLearning/kanban-board/src/App.css | 9 ++++----- ReactLearning/kanban-board/src/App.tsx | 16 ++-------------- ReactLearning/kanban-board/src/components/Header.tsx | 17 +++++------------ ReactLearning/kanban-board/src/types/Priority.ts | 2 ++ ReactLearning/kanban-board/src/types/TaskPassback.ts | 10 ++++++++++ 5 files changed, 23 insertions(+), 31 deletions(-) create mode 100644 ReactLearning/kanban-board/src/types/Priority.ts create mode 100644 ReactLearning/kanban-board/src/types/TaskPassback.ts diff --git a/ReactLearning/kanban-board/src/App.css b/ReactLearning/kanban-board/src/App.css index a2e724a..36938ff 100644 --- a/ReactLearning/kanban-board/src/App.css +++ b/ReactLearning/kanban-board/src/App.css @@ -17,22 +17,21 @@ html { font-size: 16pt; color: #ddd; border-style: line; - background-color: #404552; } - + /* For some reason, the CSS i need to use to get this to work isn't coming to me >:( */ .KBColumn { text-align: center; display: block; float: left; - width:initial; - flex-grow:inherit; + width: initial; + flex-grow: inherit; border-color: #ddd; border-width: 2px; border-style: solid; color: "orange"; } -.panel{ +.panel { width: 100%; } diff --git a/ReactLearning/kanban-board/src/App.tsx b/ReactLearning/kanban-board/src/App.tsx index 6a1d7b3..bab5e45 100644 --- a/ReactLearning/kanban-board/src/App.tsx +++ b/ReactLearning/kanban-board/src/App.tsx @@ -2,20 +2,8 @@ import React from "react"; import KBColumn from "./components/KBColumn"; import "./App.css"; import Header from "./components/Header"; -import Task from "./types/Task"; -type TaskPassback = { - title: string; - description: string; - priority: "normal" | "important" | "urgent"; - column: number; -}; - -type Column = { - id: number; - name: string; - color: string; - tasks: Task[]; -}; +import Column from "./types/Column"; +import TaskPassback from "./types/TaskPassback"; type State = { columns: Column[]; diff --git a/ReactLearning/kanban-board/src/components/Header.tsx b/ReactLearning/kanban-board/src/components/Header.tsx index bf51281..96b6dcc 100644 --- a/ReactLearning/kanban-board/src/components/Header.tsx +++ b/ReactLearning/kanban-board/src/components/Header.tsx @@ -1,16 +1,9 @@ import React from "react"; import Modal from "./Modal"; -import Task from "../types/Task"; -import Column from "../types/Column" -type TaskPassback = { - title: string; - description: string; - priority: priority; - column: number; -}; - +import Column from "../types/Column"; +import TaskPassback from "../types/TaskPassback"; +import Priority from "../types/Priority"; -type priority = "normal" | "important" | "urgent"; type HeaderProps = { addColumn: () => void; addTask: (taskInstance?: TaskPassback) => void; @@ -21,7 +14,7 @@ type State = { show: boolean; titleVar: string; descVar: string; - prioVar: priority; + prioVar: Priority; columnNumber: number; }; @@ -62,7 +55,7 @@ class Header extends React.Component { handleSelectChange(event: React.ChangeEvent) { if (event.target.id === "prioritySelect") { - const selectedValue = event.target.value as priority; + const selectedValue = event.target.value as Priority; this.setState({ prioVar: selectedValue }); } diff --git a/ReactLearning/kanban-board/src/types/Priority.ts b/ReactLearning/kanban-board/src/types/Priority.ts new file mode 100644 index 0000000..03a4edf --- /dev/null +++ b/ReactLearning/kanban-board/src/types/Priority.ts @@ -0,0 +1,2 @@ +type Priority = "normal" | "important" | "urgent"; +export default Priority; diff --git a/ReactLearning/kanban-board/src/types/TaskPassback.ts b/ReactLearning/kanban-board/src/types/TaskPassback.ts new file mode 100644 index 0000000..37bab69 --- /dev/null +++ b/ReactLearning/kanban-board/src/types/TaskPassback.ts @@ -0,0 +1,10 @@ +import Priority from "./Priority"; + +type TaskPassback = { + title: string; + description: string; + priority: Priority; + column: number; +}; + +export default TaskPassback;