diff --git a/client/src/components/Cards/TicketCard.tsx b/client/src/components/Cards/TicketCard.tsx index f7e2597..af5a36d 100644 --- a/client/src/components/Cards/TicketCard.tsx +++ b/client/src/components/Cards/TicketCard.tsx @@ -1,36 +1,103 @@ import React, { FC, MouseEvent } from "react"; +import { Button, Typography, Grid } from "@material-ui/core"; +import { createStyles, makeStyles, Theme } from "@material-ui/core/styles"; +import Chip from "@material-ui/core/Chip"; +import Paper from "@material-ui/core/Paper"; +import CategoryIcon from "@material-ui/icons/Category"; +import PriorityHighIcon from "@material-ui/icons/PriorityHigh"; +import SpeedIcon from "@material-ui/icons/Speed"; import { HorizontalCard } from "./HorizontalCard"; -import { Button, Typography } from "@material-ui/core"; +import { Ticket } from "../../types/Ticket"; import { getRemainingdays } from "../../utils/methods"; interface IProps { - title?: string; - remainingDays?: string; + ticket?: Ticket; validateTicket?: (event: MouseEvent) => void; link?: string; } -const TicketCard: FC = ({ - title, - remainingDays, - link = "#", - validateTicket, -}) => { +const useStyles = makeStyles((theme: Theme) => + createStyles({ + root: { + display: "flex", + justifyContent: "center", + flexWrap: "wrap", + listStyle: "none", + padding: theme.spacing(0.5), + margin: 0, + marginTop: 20, + marginBottom: 20, + }, + chip: { + margin: theme.spacing(0.5), + }, + }) +); + +const TicketCard: FC = ({ link = "#", validateTicket, ticket }) => { + const ChipsArray: FC = () => { + const classes = useStyles(); + const chipData = [ + // { label: "status", value: ticket?.status }, + { label: "category", value: ticket?.category }, + { label: "impact", value: ticket?.impact }, + { label: "difficulty", value: ticket?.difficulty }, + ]; + + return ( + // + + {chipData.map((data, i: number) => { + let icon = ; + let color: + | "inherit" + | "default" + | "primary" + | "secondary" + | undefined; + + if (data.label === "impact") { + color = "primary"; + icon = ; + } + if (data.label === "difficulty") { + color = "secondary"; + icon = ; + } + + return ( +
  • + +
  • + ); + })} +
    + ); + }; + const Content: FC = () => { return ( - - - Due in{" "} - {remainingDays ? ( - getRemainingdays(remainingDays) - ) : ( - - Too much 0 - - )}{" "} - days - - + + + + + Due in{" "} + {ticket?.endingDate ? ( + getRemainingdays(ticket?.endingDate) + ) : ( + + Too much 0 + + )}{" "} + days + + + ); }; @@ -46,7 +113,7 @@ const TicketCard: FC = ({ return ( } actions={} diff --git a/client/src/components/Lists/TicketList.tsx b/client/src/components/Lists/TicketList.tsx index 75efda4..e6910c5 100644 --- a/client/src/components/Lists/TicketList.tsx +++ b/client/src/components/Lists/TicketList.tsx @@ -106,8 +106,7 @@ export const TicketList: FC = ({ filteredTickets.map((t: Ticket) => ( { e.preventDefault();