From 3f0b78f085449544178060a2addfc3f12092d0f9 Mon Sep 17 00:00:00 2001 From: Ruidy Nemausat Date: Fri, 17 Apr 2020 10:44:16 +0200 Subject: [PATCH] [UI] updated TicketList --- README.md | 1 + client/src/components/TicketList.tsx | 43 +++++++++++++++++++++------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index bb1b2e4..bf36f53 100644 --- a/README.md +++ b/README.md @@ -53,3 +53,4 @@ - [x] Form validators - [x] Azure - [ ] Refactor TabPanels code +- [ ] Refactor Lists code diff --git a/client/src/components/TicketList.tsx b/client/src/components/TicketList.tsx index d780d93..edc4c9c 100644 --- a/client/src/components/TicketList.tsx +++ b/client/src/components/TicketList.tsx @@ -1,14 +1,28 @@ import React, { FC, useState, ChangeEvent, MouseEvent } from "react"; -import { Ticket } from "../types/Ticket"; +import { + Grid, + Typography, + makeStyles, + Theme, + createStyles, +} from "@material-ui/core"; import { FloatingButton } from "./FloatingButton"; import { HorizontalCard } from "./HorizontalCard"; import { FilterBar } from "./FilterBar"; import { HttpResponse } from "../types/HttpResponse"; -import { put } from "../utils/http"; -import { Constants } from "../utils/Constants"; +import { Ticket } from "../types/Ticket"; import { NewTicketModal } from "./NewTicketModal"; import { Project } from "../types/Project"; -import { Grid, Typography } from "@material-ui/core"; +import { put } from "../utils/http"; +import { Constants } from "../utils/Constants"; + +const useStyles = makeStyles((theme: Theme) => + createStyles({ + header: { + paddingBottom: theme.spacing(2), + }, + }) +); type TicketListProps = { tickets: Ticket[]; @@ -19,7 +33,7 @@ type TicketListProps = { export const TicketList: FC = ({ tickets, allProjects, - addButton = true + addButton = true, }) => { const [filterText, setFilterText] = useState(""); const clearFilterText = (e: MouseEvent): void => { @@ -36,10 +50,13 @@ export const TicketList: FC = ({ const [showNew, setShowNew] = useState(false); let filteredTickets = tickets.filter( - t => + (t) => t.status !== "Done" && t.title.toLowerCase().includes(filterText.toLowerCase()) ); + + const classes = useStyles(); + return ( <> = ({ /> - + Tickets - - + {addButton && ( )} - - +