diff --git a/src/components/SectionClientSay.tsx b/src/components/SectionClientSay.tsx new file mode 100644 index 0000000..ff95d25 --- /dev/null +++ b/src/components/SectionClientSay.tsx @@ -0,0 +1,192 @@ +"use client"; + +import Heading from "@/shared/Heading"; +import React, { FC, useState } from "react"; +import clientSayMain from "@/images/clientSayMain.png"; +import clientSay1 from "@/images/clientSay1.png"; +import clientSay2 from "@/images/clientSay2.png"; +import clientSay3 from "@/images/clientSay3.png"; +import clientSay4 from "@/images/clientSay4.png"; +import clientSay5 from "@/images/clientSay5.png"; +import clientSay6 from "@/images/clientSay6.png"; +import quotationImg from "@/images/quotation.png"; +import quotationImg2 from "@/images/quotation2.png"; +import { MapPinIcon } from "@heroicons/react/24/outline"; +import { AnimatePresence, motion, MotionConfig } from "framer-motion"; +import Image from "next/image"; +import { useSwipeable } from "react-swipeable"; +import { variants } from "@/utils/animationVariants"; + +export interface SectionClientSayProps { + className?: string; + data?: typeof DEMO_DATA; +} + +const DEMO_DATA = [ + { + id: 1, + clientName: "Tiana Abie", + clientAddress: "Malaysia", + content: + "This place is exactly like the picture posted on Chisfis. Great service, we had a great stay!", + }, + { + id: 2, + clientName: "Lennie Swiffan", + clientAddress: "London", + content: + "This place is exactly like the picture posted on Chisfis. Great service, we had a great stay!", + }, + { + id: 3, + clientName: "Berta Emili", + clientAddress: "Tokyo", + content: + "This place is exactly like the picture posted on Chisfis. Great service, we had a great stay!", + }, +]; + +const SectionClientSay: FC = ({ + className = "", + data = DEMO_DATA, +}) => { + const [index, setIndex] = useState(0); + const [direction, setDirection] = useState(0); + + function changeItemId(newVal: number) { + if (newVal > index) { + setDirection(1); + } else { + setDirection(-1); + } + setIndex(newVal); + } + + const handlers = useSwipeable({ + onSwipedLeft: () => { + if (index < data?.length - 1) { + changeItemId(index + 1); + } + }, + onSwipedRight: () => { + if (index > 0) { + changeItemId(index - 1); + } + }, + trackMouse: true, + }); + + let currentItem = data[index]; + + const renderBg = () => { + return ( +
+ client 1 + client 2 + client 3 + client 4 + client 5 + client 6 +
+ ); + }; + + return ( +
+ + Good news from far away + +
+ {renderBg()} + +
+ + + + +
+ + + <> + + {currentItem.content} + + + {currentItem.clientName} + +
+ + {currentItem.clientAddress} +
+ +
+
+ +
+ {data.map((item, i) => ( +
+
+
+
+
+
+ ); +}; + +export default SectionClientSay;