source: frontend/src/components/cards/restoran-card.jsx@ badbc79

Last change on this file since badbc79 was badbc79, checked in by Luka Cheshlarov <luka.cheshlarov@…>, 20 months ago

Initial commit

  • Property mode set to 100644
File size: 2.0 KB
Line 
1import React from "react";
2import {useNavigate} from "react-router-dom";
3import {Card, CardContent, CardHeader, CardMedia, IconButton, Typography} from "@mui/material";
4import {ManageAccountsRounded} from "@mui/icons-material";
5import {useAuthContext} from "../../configurations/AuthContext";
6import {UserRole} from "../../services/user-service";
7import RestourantImage from "../../assets/images/restorant-logo2.jpg";
8
9function MoreVertIcon() {
10 return null;
11}
12
13const RestoranCard = ({restoran}) => {
14 const navigate = useNavigate();
15 const {loggedUserRole} = useAuthContext();
16
17 return (
18 restoran != null &&
19 <Card className={`card-zoom m-3 cursor-pointer`} onClick={() => navigate(`/restorants/${restoran.id}`)}>
20 <CardHeader
21 avatar={
22 restoran.manager.id === loggedUserRole?.roleId && loggedUserRole?.role === UserRole.Menager &&
23 <ManageAccountsRounded/>
24 }
25 action={
26 <IconButton aria-label="settings">
27 <MoreVertIcon/>
28 </IconButton>
29 }
30 title={restoran.manager.korisnik.username.toUpperCase()}
31 subheader="Manager"
32 />
33 <CardMedia
34 component="img"
35 height="200"
36 image={RestourantImage}
37 alt="Paella dish"
38 />
39 <CardContent className={" text-center"}>
40 <Typography variant={"h5"}
41 className={"font-weight-bold mt-3 text-center"}
42 >{restoran.ime}
43 </Typography>
44 <Typography className={"text-center card-description m-0 mb-4"}
45 >{restoran.lokacija}
46 </Typography>
47 <Typography className={"text-center card-description m-0 mb-4"}
48 > {restoran.rabotnoVreme}
49 </Typography>
50 </CardContent>
51 </Card>
52 )
53}
54
55export default RestoranCard;
Note: See TracBrowser for help on using the repository browser.