ListingItems.js 3.16 KB
import Image from "next/image";
import { useRouter } from "next/router";
import React from "react";
import { Button } from "react-bootstrap";
import { cleanImage } from "../../services/imageHandling";

const ListingItems = ({ allActivitiesData }) => {
  console.log("allActivitiesData", allActivitiesData);
  const router = useRouter();
  return (
    <>
      <div className="listing-items">
        <div className="row">
          {allActivitiesData &&
            allActivitiesData.data.map(data => {
              return (
                <div className="col-md-3">
                  <div className="item">
                    <div className="browse-experiences-item">
                      <div className="img-wrapper">
                        <span className="image-container">
                          <Image layout="fill" alt="" className="image img-fluid" src={cleanImage(data.attributes?.image?.data?.attributes)} />
                        </span>
                        <div className="top-rated">Top Rated</div>
                      </div>
                      <div className="info">
                        <div className="top-name">
                          <div className="title">{data?.attributes?.name}</div>
                          <div className="rating-wishlist">
                            <div className="rating">
                              {data?.attributes?.rating}
                              <span className="image-container">
                                <Image layout="fill" alt="" className="image img-fluid" src="/images/icons/star.svg" />
                              </span>
                            </div>
                            <div className="wishlist">
                              <span className="image-container">
                                <Image layout="fill" alt="" className="image img-fluid" src="/images/icons/wishlist.svg" />
                              </span>
                            </div>
                          </div>
                        </div>
                        <div className="discription">
                          {data.discription} <a href="">Read More</a>
                        </div>
                        <div className="price">
                          ${data?.attributes?.pricePerPerson} <span className="off">{data?.attributes?.off}% OFF</span>
                        </div>
                        <div className="detail">
                          <div className="">For 1 Night</div>
                          <div className="">Includes taxes & Fees</div>
                        </div>
                        <div className="explore-now">
                          <Button
                            onClick={() => {
                              router.push(`/activities/${data.id}`);
                            }}
                            variant="primary"
                          >
                            Explore Now
                          </Button>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              );
            })}
        </div>
      </div>
    </>
  );
};

export default ListingItems;