add click handler

This commit is contained in:
nflnkr 2023-03-21 16:00:04 +03:00
parent a6ea352180
commit 45ec218cde

@ -2,6 +2,7 @@ import CircleIcon from '@mui/icons-material/Circle';
import { Box, Card, CardActionArea, CardContent, useTheme } from "@mui/material"; import { Box, Card, CardActionArea, CardContent, useTheme } from "@mui/material";
import { green } from '@mui/material/colors'; import { green } from '@mui/material/colors';
import { Ticket } from "@root/model/ticket"; import { Ticket } from "@root/model/ticket";
import { useNavigate } from 'react-router-dom';
const flexCenterSx = { const flexCenterSx = {
@ -18,6 +19,7 @@ interface Props {
export default function TicketItem({ isUnread, ticket }: Props) { export default function TicketItem({ isUnread, ticket }: Props) {
const theme = useTheme(); const theme = useTheme();
const navigate = useNavigate();
const unreadSx = { const unreadSx = {
border: "1px solid", border: "1px solid",
@ -25,13 +27,17 @@ export default function TicketItem({ isUnread, ticket }: Props) {
backgroundColor: theme.palette.goldenMedium.main backgroundColor: theme.palette.goldenMedium.main
}; };
function handleCardClick() {
navigate(`/support/${ticket.id}`);
}
return ( return (
<Card sx={{ <Card sx={{
minHeight: "70px", minHeight: "70px",
backgroundColor: "transparent", backgroundColor: "transparent",
color: "white", color: "white",
}}> }}>
<CardActionArea> <CardActionArea onClick={handleCardClick}>
<CardContent sx={{ <CardContent sx={{
display: "flex", display: "flex",
justifyContent: "space-between", justifyContent: "space-between",