芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/rentandbuyrealty.com/rentandbuyrealty.com/web/src/Components/Cards/ProjectCard.jsx
import { Swiper, SwiperSlide } from "swiper/react"; import Image from "next/image"; import "swiper/css"; import "swiper/css/free-mode"; import "swiper/css/navigation"; import { FreeMode, Navigation, Autoplay } from 'swiper/modules'; import { useCallback, useRef } from "react"; import { FaArrowLeft, FaArrowRight, FaCrown } from "react-icons/fa"; import { ImageToSvg } from "./ImageToSvg"; import { isThemeEnabled, placeholderImage } from "@/utils"; import { settingsData } from "@/store/reducer/settingsSlice"; import { useSelector } from "react-redux"; const ProjectCard = ({ ele }) => { const titleImage = ele.image; const galleryImages = ele?.gallary_images?.filter(image => typeof image === 'object' && image.hasOwnProperty('name')).map(image => image.name); const images = [titleImage, ...galleryImages]?.slice(0, 3);; const sliderRef = useRef(null); const handlePrev = useCallback((e) => { e.preventDefault(); e.stopPropagation(); if (!sliderRef.current) return; sliderRef.current.swiper.slidePrev(); }, []); const handleNext = useCallback((e) => { e.preventDefault(); e.stopPropagation(); if (!sliderRef.current) return; sliderRef.current.swiper.slideNext(); }, []); const themeEnabled = isThemeEnabled(); return (
{themeEnabled ? (
) : (
)}
{ele.category && ele.category.category}
{ele.title}
{ele.city} {ele.city ? "," : null} {ele.state} {ele.state ? "," : null} {ele.country}
{images.map((image, index) => (
))}
{images && images.length > 1 && <>
> }
); }; export default ProjectCard;