From 70398f1cc211cafa8f49c4d443664a0e35a54bc6 Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 10 Sep 2023 17:29:15 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20Implemented=20StayCard?= =?UTF-8?q?=20component=20=F0=9F=96=BC=EF=B8=8F=20Added=20image=20gallery,?= =?UTF-8?q?=20content=20rendering=20=F0=9F=8F=B7=EF=B8=8F=20Included=20lis?= =?UTF-8?q?ting=20details=20and=20pricing=20=E2=AD=90=20Added=20review=20r?= =?UTF-8?q?atings=20and=20badges=20=F0=9F=94=97=20Integrated=20Link=20for?= =?UTF-8?q?=20navigation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/StayCard.tsx | 132 ++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 src/components/StayCard.tsx diff --git a/src/components/StayCard.tsx b/src/components/StayCard.tsx new file mode 100644 index 0000000..bb795a2 --- /dev/null +++ b/src/components/StayCard.tsx @@ -0,0 +1,132 @@ +import React, { FC } from "react"; +import { DEMO_STAY_LISTINGS } from "@/data/listings"; +import { StayDataType } from "@/data/types"; +import StartRating from "@/components/StartRating"; +import BtnLikeIcon from "@/components/BtnLikeIcon"; +import SaleOffBadge from "@/components/SaleOffBadge"; +import Badge from "@/shared/Badge"; +import Link from "next/link"; +import GallerySlider from "./GallerySlider"; + +export interface StayCardProps { + className?: string; + data?: StayDataType; + size?: "default" | "small"; +} + +const DEMO_DATA = DEMO_STAY_LISTINGS[0]; + +const StayCard: FC = ({ + size = "default", + className = "", + data = DEMO_DATA, +}) => { + const { + galleryImgs, + listingCategory, + address, + title, + bedrooms, + href, + like, + saleOff, + isAds, + price, + reviewStart, + reviewCount, + id, + } = data; + + const renderSliderGallery = () => { + return ( +
+ + + {saleOff && } +
+ ); + }; + + const renderContent = () => { + return ( +
+
+ + {listingCategory.name} ยท {bedrooms} beds + +
+ {isAds && } +

+ {title} +

+
+
+ {size === "default" && ( + + + + + )} + {address} +
+
+
+
+ + {price} + {` `} + {size === "default" && ( + + /night + + )} + + {!!reviewStart && ( + + )} +
+
+ ); + }; + + return ( +
+ {renderSliderGallery()} + {renderContent()} +
+ ); +}; + +export default StayCard;