From 6cf52b256bb94e6682db944445c85b8e428ff3fd Mon Sep 17 00:00:00 2001 From: Ruidy Nemausat Date: Sun, 23 Feb 2020 00:56:02 +0100 Subject: [PATCH] modal component added --- client/src/components/Button.tsx | 6 ++-- client/src/components/FloatingButton.tsx | 8 ++++-- client/src/components/Modal.tsx | 17 +++++++++++ client/src/components/TicketList.tsx | 30 ++++++-------------- client/src/controllers/ProjectController.tsx | 2 +- client/src/pages/ProjectPage.tsx | 2 ++ client/src/utils/Constants.ts | 4 ++- 7 files changed, 40 insertions(+), 29 deletions(-) create mode 100644 client/src/components/Modal.tsx diff --git a/client/src/components/Button.tsx b/client/src/components/Button.tsx index 8fc9f86..bb3c49b 100644 --- a/client/src/components/Button.tsx +++ b/client/src/components/Button.tsx @@ -1,4 +1,4 @@ -import React, { FC } from "react"; +import React, { FC, MouseEvent } from "react"; interface IProps { icon?: string; @@ -6,18 +6,20 @@ interface IProps { shape?: string; color?: string; text?: string; + onClick?: (e: MouseEvent) => void; } export const Button: FC = ({ size = "small", shape = "", color, - text, + onClick, children }) => { return ( diff --git a/client/src/components/FloatingButton.tsx b/client/src/components/FloatingButton.tsx index eb9dfd1..0031443 100644 --- a/client/src/components/FloatingButton.tsx +++ b/client/src/components/FloatingButton.tsx @@ -1,20 +1,22 @@ -import React, { FC } from "react"; +import React, { FC, MouseEvent } from "react"; import { Button } from "./Button"; interface IProps { icon?: string; size?: string; color?: string; + onClick?: (e: MouseEvent) => void; } export const FloatingButton: FC = ({ icon = "add", size = "small", - color = "red" + color = "red", + onClick }) => { const iconComponent = {icon}; return ( - ); diff --git a/client/src/components/Modal.tsx b/client/src/components/Modal.tsx new file mode 100644 index 0000000..714f860 --- /dev/null +++ b/client/src/components/Modal.tsx @@ -0,0 +1,17 @@ +import React, { FC } from "react"; + +export const Modal: FC = () => { + return ( +
+
+

Modal Header

+

A bunch of text

+
+
+ + Agree + +
+
+ ); +}; diff --git a/client/src/components/TicketList.tsx b/client/src/components/TicketList.tsx index 5864041..d1be3c3 100644 --- a/client/src/components/TicketList.tsx +++ b/client/src/components/TicketList.tsx @@ -15,38 +15,24 @@ export const TicketList: FC = ({ tickets }) => { }; const archiveTicket = () => {}; const validateTicket = () => {}; - + const onClick: (e: MouseEvent) => void = (e: MouseEvent) => { + e.preventDefault(); + }; const handleChange: (e: ChangeEvent) => void = ( e: ChangeEvent ) => { setFilterText(e.target.value); }; - // const useFilter = (init: string) => { - // const [filterText, setFilterText] = useState(init); - // // const handleChange: (e: ChangeEvent) => void = ( - // // e: ChangeEvent - // // ) => { - // // setFilterText(e.target.value); - // // }; - // return { - // filterText, - // setFilterText, - // bind: { - // filterText, - // handleChange: (e: ChangeEvent) => { - // setFilterText(e.target.value); - // } - // } - // }; - // }; - // const [filterText, handleChange] = useFilter(""); - // const [filterText, handleChange] = useFilter(""); return ( <>

Tickets

- + { async function httpGet(id: string): Promise { try { const response: HttpResponse = await get( - `${Constants.getProjectURI}/${id}` + `${Constants.projectsURI}/${id}` ); if (response.parsedBody !== undefined) { setProject(response.parsedBody); diff --git a/client/src/pages/ProjectPage.tsx b/client/src/pages/ProjectPage.tsx index 7e79034..f0f03fd 100644 --- a/client/src/pages/ProjectPage.tsx +++ b/client/src/pages/ProjectPage.tsx @@ -5,6 +5,7 @@ import { ProgressBar } from "../components/ProgressBar"; import ProjectVM from "../VM/ProjectVM"; import { TabRouter } from "../components/TabRouter"; import { FloatingButton } from "../components/FloatingButton"; +import { Modal } from "../components/Modal"; interface IProps { viewModel: ProjectVM; @@ -23,6 +24,7 @@ export const ProjectPage: FC = ({ viewModel }) => { activities } = viewModel; const tabNames: string[] = ["Tickets", "Files", "Activity"]; + return (
diff --git a/client/src/utils/Constants.ts b/client/src/utils/Constants.ts index e714aa1..cdfb2b9 100644 --- a/client/src/utils/Constants.ts +++ b/client/src/utils/Constants.ts @@ -1,3 +1,5 @@ export class Constants { - static getProjectURI: string = "/api/v1/projects"; + static projectsURI: string = "/api/v1/projects"; + static ticketsURI: string = "/api/v1/tickets"; + static usersURI: string = "/api/v1/users"; }