From 39896a06ed283fb754133d37bf78aaa0e02fb116 Mon Sep 17 00:00:00 2001 From: Ste Vaidis Date: Fri, 17 Feb 2023 21:44:18 +0200 Subject: [PATCH] price theming --- app/components/Price.tsx | 29 +++++++++++++++++++++++++++++ app/components/RestaurantCard.tsx | 3 ++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 app/components/Price.tsx diff --git a/app/components/Price.tsx b/app/components/Price.tsx new file mode 100644 index 0000000..3047a67 --- /dev/null +++ b/app/components/Price.tsx @@ -0,0 +1,29 @@ +import { PRICE } from "@prisma/client"; + +export default function Price({ price }: { price: PRICE }) { + const renderPrice = () => { + if (price === PRICE.CHEAP) { + return ( + <> + $$$$ + + ); + } + if (price === PRICE.REGULAR) { + return ( + <> + $$$$ + + ); + } + if (price === PRICE.EXPENSIVE) { + return ( + <> + $$$$ + + ); + } + }; + + return

{renderPrice()}

; +} diff --git a/app/components/RestaurantCard.tsx b/app/components/RestaurantCard.tsx index 67bbf4a..a1d5119 100644 --- a/app/components/RestaurantCard.tsx +++ b/app/components/RestaurantCard.tsx @@ -1,5 +1,6 @@ import Link from "next/link"; import { RestaurantCardType } from "../page"; +import Price from "./Price"; interface Props { restaurant: RestaurantCardType; @@ -22,7 +23,7 @@ export default function RestaurantCard({restaurant}: Props) {

{restaurant.cuisine.name}

-

$$$$

+

{restaurant.location.name}

Booked 3 times today