mirror of
https://github.com/rjNemo/ticket_manager
synced 2026-06-06 08:46:39 +00:00
57 lines
1.1 KiB
TypeScript
57 lines
1.1 KiB
TypeScript
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<IProps> = ({
|
|
title,
|
|
remainingDays,
|
|
link = "#",
|
|
validateTicket,
|
|
}) => {
|
|
const Content: FC = () => {
|
|
return (
|
|
<Typography variant="body2" component="p">
|
|
<span>
|
|
Due{" "}
|
|
{remainingDays ? (
|
|
getRemainingdays(remainingDays)
|
|
) : (
|
|
<span>
|
|
<del>Too much</del> 0
|
|
</span>
|
|
)}{" "}
|
|
days
|
|
</span>
|
|
</Typography>
|
|
);
|
|
};
|
|
|
|
const Action = () => {
|
|
return (
|
|
<>
|
|
<Button size="small" onClick={validateTicket}>
|
|
Mark as done
|
|
</Button>
|
|
</>
|
|
);
|
|
};
|
|
|
|
return (
|
|
<HorizontalCard
|
|
title={title}
|
|
link={link}
|
|
content={<Content />}
|
|
actions={<Action />}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default TicketCard;
|