diff --git a/client/src/components/HorizontalCard.tsx b/client/src/components/HorizontalCard.tsx index 6f0a7cc..8f5763a 100644 --- a/client/src/components/HorizontalCard.tsx +++ b/client/src/components/HorizontalCard.tsx @@ -1,4 +1,4 @@ -import React, { FC, MouseEvent } from "react"; +import React, { FC, MouseEvent, ReactNode } from "react"; import { Link } from "react-router-dom"; import { makeStyles } from "@material-ui/core/styles"; import Card from "@material-ui/core/Card"; @@ -10,33 +10,22 @@ import { getRemainingdays } from "../utils/methods"; interface IProps { title?: string; - remainingDays?: string; - validateTicket?: (event: MouseEvent) => void; link?: string; + content: ReactNode; + actions?: ReactNode; } const useStyles = makeStyles({ root: { - minWidth: 275 + minWidth: 275, }, - bullet: { - display: "inline-block", - margin: "0 2px", - transform: "scale(0.8)" - }, - title: { - fontSize: 14 - }, - pos: { - marginBottom: 12 - } }); export const HorizontalCard: FC = ({ title, - remainingDays, link = "#", - validateTicket + content, + actions, }) => { const classes = useStyles(); @@ -48,26 +37,9 @@ export const HorizontalCard: FC = ({ {title ?? "Nothing to do"} - - - - Due{" "} - {remainingDays ? ( - getRemainingdays(remainingDays) - ) : ( - - Too much 0 - - )}{" "} - days - - + {content} - - - + {actions} ); }; diff --git a/client/src/components/ProjectCard.tsx b/client/src/components/ProjectCard.tsx new file mode 100644 index 0000000..802f8de --- /dev/null +++ b/client/src/components/ProjectCard.tsx @@ -0,0 +1,34 @@ +import React, { FC, MouseEvent } from "react"; +import { HorizontalCard } from "./HorizontalCard"; +import { Typography } from "@material-ui/core"; +import { getRemainingdays } from "../utils/methods"; + +interface IProps { + title?: string; + remainingDays?: string; + link?: string; +} + +const ProjectCard: FC = ({ title, remainingDays, link = "#" }) => { + const Content: FC = () => { + return ( + + + Due{" "} + {remainingDays ? ( + getRemainingdays(remainingDays) + ) : ( + + Too much 0 + + )}{" "} + days + + + ); + }; + + return } />; +}; + +export default ProjectCard; diff --git a/client/src/components/ProjectList.tsx b/client/src/components/ProjectList.tsx index cc758e3..8fb8af7 100644 --- a/client/src/components/ProjectList.tsx +++ b/client/src/components/ProjectList.tsx @@ -13,6 +13,7 @@ import { HttpResponse } from "../types/HttpResponse"; import { Project } from "../types/Project"; import { put } from "../utils/http"; import { Constants } from "../utils/Constants"; +import ProjectCard from "./ProjectCard"; const useStyles = makeStyles((theme: Theme) => createStyles({ @@ -65,21 +66,21 @@ export const ProjectList: FC = ({ projects }) => {
{filteredTickets.length === 0 ? ( - + ) : ( filteredTickets.map((t: Project) => ( - { - e.preventDefault(); - await put>( - `${Constants.ticketsURI}/${t.id}/closed`, - {} - ); - }} + // validateTicket={async (e: MouseEvent) => { + // e.preventDefault(); + // await put>( + // `${Constants.ticketsURI}/${t.id}/closed`, + // {} + // ); + // }} /> )) )} diff --git a/client/src/components/TicketCard.tsx b/client/src/components/TicketCard.tsx new file mode 100644 index 0000000..f1130f6 --- /dev/null +++ b/client/src/components/TicketCard.tsx @@ -0,0 +1,57 @@ +import React, { FC, MouseEvent } from "react"; +import { HorizontalCard } from "./HorizontalCard"; +import { Button, Typography } from "@material-ui/core"; +import { getRemainingdays } from "../utils/methods"; + +interface IProps { + title?: string; + remainingDays?: string; + validateTicket?: (event: MouseEvent) => void; + link?: string; +} + +const TicketCard: FC = ({ + title, + remainingDays, + link = "#", + validateTicket, +}) => { + const Content: FC = () => { + return ( + + + Due{" "} + {remainingDays ? ( + getRemainingdays(remainingDays) + ) : ( + + Too much 0 + + )}{" "} + days + + + ); + }; + + const Action = () => { + return ( + <> + + + ); + }; + + return ( + } + actions={} + /> + ); +}; + +export default TicketCard; diff --git a/client/src/components/TicketList.tsx b/client/src/components/TicketList.tsx index 99d9e2e..87630f9 100644 --- a/client/src/components/TicketList.tsx +++ b/client/src/components/TicketList.tsx @@ -15,6 +15,7 @@ import { NewTicketModal } from "./NewTicketModal"; import { Project } from "../types/Project"; import { put } from "../utils/http"; import { Constants } from "../utils/Constants"; +import TicketCard from "./TicketCard"; const useStyles = makeStyles((theme: Theme) => createStyles({ @@ -101,10 +102,10 @@ export const TicketList: FC = ({
{filteredTickets.length === 0 ? ( - + ) : ( filteredTickets.map((t: Ticket) => ( -