From ed237a6342987ebcf9ed6a9ef8b6be3bdcb9d582 Mon Sep 17 00:00:00 2001 From: Ruidy Nemausat Date: Sun, 9 Feb 2020 22:52:29 +0100 Subject: [PATCH] horizontal card --- client/src/components/AvatarList.tsx | 10 ++--- client/src/components/HorizontalCard.tsx | 41 +++++++++++++++++ client/src/components/TabRouter.tsx | 54 +++++++++++++++++------ client/src/components/TabRouterHeader.tsx | 10 +++-- client/src/components/TicketList.tsx | 41 ++++++++++++++--- client/src/pages/ProjectPage.tsx | 20 +++++---- 6 files changed, 140 insertions(+), 36 deletions(-) create mode 100644 client/src/components/HorizontalCard.tsx diff --git a/client/src/components/AvatarList.tsx b/client/src/components/AvatarList.tsx index 1b83021..7075728 100644 --- a/client/src/components/AvatarList.tsx +++ b/client/src/components/AvatarList.tsx @@ -1,18 +1,16 @@ import React, { FC } from "react"; -import { Button } from "./Button"; import { FloatingButton } from "./FloatingButton"; -type AvatarListProps = { +interface AvatarListProps { avatars: string[]; -}; +} export const AvatarList: FC = ({ avatars }) => { return ( -
+ <> {avatars.map((avatar: string) => ( ))} - -
+ ); }; diff --git a/client/src/components/HorizontalCard.tsx b/client/src/components/HorizontalCard.tsx new file mode 100644 index 0000000..b613116 --- /dev/null +++ b/client/src/components/HorizontalCard.tsx @@ -0,0 +1,41 @@ +import React, { FC } from "react"; +import { AvatarList } from "./AvatarList"; + +interface IProps { + title: string; + tasksTotalCount?: number; + tasksDone?: number; + remainingDays?: number; + avatars: string[]; +} + +export const HorizontalCard: FC = ({ + title, + tasksDone, + tasksTotalCount, + remainingDays, + avatars +}) => { + return ( +
+
+
+
+
{title}
+ +
+ playlist_add_check + + {tasksDone}/{tasksTotalCount} + + +
+ Due {remainingDays} days +
+
+
+
+
+
+ ); +}; diff --git a/client/src/components/TabRouter.tsx b/client/src/components/TabRouter.tsx index 192f1f1..4f16a81 100644 --- a/client/src/components/TabRouter.tsx +++ b/client/src/components/TabRouter.tsx @@ -1,22 +1,50 @@ import React, { FC } from "react"; import { TabRouterHeader } from "./TabRouterHeader"; +import { TicketList } from "./TicketList"; +import { Ticket } from "../types/Ticket"; +import { Switch, Route, useRouteMatch } from "react-router-dom"; -interface IProps {} -export const TabRouter: FC = ({ children }) => { +interface IProps { + tickets: Ticket[]; + tasksTotalCount?: number; + tasksDone?: number; + remainingDays?: number; + avatars: string[]; +} + +export const TabRouter: FC = ({ + tickets, + tasksDone, + tasksTotalCount, + remainingDays, + avatars +}) => { + const { url } = useRouteMatch(); return ( <> -
- -
- Tickets + +
+ + + + + + + + {/* */} + + + + {/* */} +
-
- Files -
-
- Activity -
-
+ ); }; diff --git a/client/src/components/TabRouterHeader.tsx b/client/src/components/TabRouterHeader.tsx index 3471bbd..b21eb11 100644 --- a/client/src/components/TabRouterHeader.tsx +++ b/client/src/components/TabRouterHeader.tsx @@ -1,4 +1,5 @@ import React, { FC, useState } from "react"; +import { Link, useRouteMatch } from "react-router-dom"; interface TabUnitProps { tabClass: string; @@ -15,16 +16,17 @@ const TabUnit: FC = ({ text, value }) => { + const { url } = useRouteMatch(); return (
  • - setIsActive(parseInt(value))} > {text} - +
  • ); }; @@ -47,7 +49,7 @@ export const TabRouterHeader: FC = ({ return ( <> -
    +
      = ({ tickets }) => { +export const TicketList: FC = ({ + tickets, + tasksDone, + tasksTotalCount, + remainingDays, + avatars +}) => { return ( -
      - {tickets.map((t: Ticket) => ( -
    • {t.title}
    • - ))} +
      +
      +
      +

      Tickets

      +
      +
      + +
      +
      + +
        + {tickets.map((t: Ticket) => ( +
      • + +
      • + ))} +
      ); }; diff --git a/client/src/pages/ProjectPage.tsx b/client/src/pages/ProjectPage.tsx index 231f401..5ce7d1e 100644 --- a/client/src/pages/ProjectPage.tsx +++ b/client/src/pages/ProjectPage.tsx @@ -2,9 +2,9 @@ import React, { FC } from "react"; import { Header } from "../components/Header"; import { AvatarList } from "../components/AvatarList"; import { ProgressBar } from "../components/ProgressBar"; -import { TicketList } from "../components/TicketList"; import ProjectVM from "../viewModels/ProjectVM"; import { TabRouter } from "../components/TabRouter"; +import { FloatingButton } from "../components/FloatingButton"; interface IProps { viewModel: ProjectVM; @@ -24,19 +24,23 @@ export const ProjectPage: FC = ({ viewModel }) => {
      - +
      + + +
      - - {/* */} - - {/* - */} - +
      );