From d0184009c3a97647269849d8a345c2b6e1a54e52 Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 10 Sep 2023 17:28:32 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Refactor=20StayCard2=20component?= =?UTF-8?q?=20=F0=9F=8E=A8=20Improve=20code=20readability=20and=20structur?= =?UTF-8?q?e=20=F0=9F=93=A6=20Add=20link=20component=20for=20improved=20na?= =?UTF-8?q?vigation=20=E2=9C=85=20Ensure=20consistent=20styling=20and=20sp?= =?UTF-8?q?acing=20=F0=9F=9A=80=20Ready=20for=20further=20development!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/StayCard2.tsx | 125 +++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 src/components/StayCard2.tsx diff --git a/src/components/StayCard2.tsx b/src/components/StayCard2.tsx new file mode 100644 index 0000000..e38ee94 --- /dev/null +++ b/src/components/StayCard2.tsx @@ -0,0 +1,125 @@ +import React, { FC } from "react"; +import GallerySlider from "@/components/GallerySlider"; +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"; + +export interface StayCard2Props { + className?: string; + data?: StayDataType; + size?: "default" | "small"; +} + +const DEMO_DATA = DEMO_STAY_LISTINGS[0]; + +const StayCard2: 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 StayCard2;