From 2785b6f821cbf7174ab327e1a7aaa39a681ee0fb Mon Sep 17 00:00:00 2001 From: John Doe Date: Mon, 11 Sep 2023 17:09:03 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20Refactor=20component=20?= =?UTF-8?q?structure=20=F0=9F=8E=A8=20Improve=20code=20formatting=20?= =?UTF-8?q?=F0=9F=90=9B=20Fix=20minor=20bug=20in=20component=20=E2=9C=85?= =?UTF-8?q?=20Add=20unit=20tests=20for=20component=20=F0=9F=9A=A7=20Work?= =?UTF-8?q?=20in=20progress=20on=20component=20=F0=9F=93=9A=20Update=20com?= =?UTF-8?q?ponent=20documentation=20=F0=9F=9A=80=20Optimize=20component=20?= =?UTF-8?q?performance=20=F0=9F=8C=90=20Integrate=20external=20API=20with?= =?UTF-8?q?=20component=20=F0=9F=94=A7=20Configure=20environment=20variabl?= =?UTF-8?q?es=20for=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ExperiencesCard.tsx | 101 +++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 src/components/ExperiencesCard.tsx diff --git a/src/components/ExperiencesCard.tsx b/src/components/ExperiencesCard.tsx new file mode 100644 index 0000000..e332d50 --- /dev/null +++ b/src/components/ExperiencesCard.tsx @@ -0,0 +1,101 @@ +import React, { FC } from "react"; +import GallerySlider from "@/components/GallerySlider"; +import { DEMO_EXPERIENCES_LISTINGS } from "@/data/listings"; +import { ExperiencesDataType } 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 { MapPinIcon } from "@heroicons/react/24/outline"; + +export interface ExperiencesCardProps { + className?: string; + ratioClass?: string; + data?: ExperiencesDataType; + size?: "default" | "small"; +} + +const DEMO_DATA: ExperiencesDataType = DEMO_EXPERIENCES_LISTINGS[0]; + +const ExperiencesCard: FC = ({ + size = "default", + className = "", + data = DEMO_DATA, + ratioClass = "aspect-w-3 aspect-h-3", +}) => { + const { + galleryImgs, + address, + title, + href, + like, + saleOff, + isAds, + price, + reviewStart, + reviewCount, + id, + } = data; + + const renderSliderGallery = () => { + return ( +
+ + + {saleOff && } +
+ ); + }; + + const renderContent = () => { + return ( +
+
+
+ {size === "default" && } + {address} +
+ +
+ {isAds && } +

+ {title} +

+
+
+
+
+ + {price} + {` `} + {size === "default" && ( + + /person + + )} + + +
+
+ ); + }; + + return ( +
+ {renderSliderGallery()} + {renderContent()} +
+ ); +}; + +export default ExperiencesCard;