-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRestaurantPreview.tsx
50 lines (46 loc) · 1.4 KB
/
RestaurantPreview.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import {
Card,
Stack,
Title,
Body,
Label,
Button,
} from "@buildo/bento-design-system";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom";
import { PreviewPropComponent } from "../models";
function RestaurantPreview(props: PreviewPropComponent) {
const { t } = useTranslation();
const rating = props.vars.rating;
const imagePrev =
props.vars.imageUrl === ""
? "https://upload.wikimedia.org/wikipedia/commons/thumb/6/62/Barbieri_-_ViaSophia25668.jpg/1200px-Barbieri_-_ViaSophia25668.jpg"
: props.vars.imageUrl;
const navigate = useNavigate();
return (
<Card elevation="small" borderRadius={8} padding={16} paddingTop={24}>
<Stack space={8} align="center">
<img
src={imagePrev}
style={{ height: "200px", width: "100%", objectFit: "scale-down" }}
/>
<Title size="medium">{props.vars.name}</Title>
<Body size="medium">
{props.vars.address}
<Label size="small" color="default">
{t("Card.Rating", { rating })}
</Label>
</Body>
<Button
onPress={() => {
return navigate(`/restaurat-detail/${props.vars.id}`);
}}
kind="transparent"
label={t("Card.ButtonLabel")}
hierarchy="primary"
></Button>
</Stack>
</Card>
);
}
export default RestaurantPreview;