|
|
@ -1,4 +1,10 @@ |
|
|
|
import React from "react"; |
|
|
|
import React from "react"; |
|
|
|
|
|
|
|
import { Swiper, SwiperSlide } from "swiper/react"; |
|
|
|
|
|
|
|
// Import Swiper styles
|
|
|
|
|
|
|
|
import "swiper/css"; |
|
|
|
|
|
|
|
import "swiper/css/navigation"; |
|
|
|
|
|
|
|
import "swiper/css/pagination"; |
|
|
|
|
|
|
|
|
|
|
|
import "./index"; |
|
|
|
import "./index"; |
|
|
|
|
|
|
|
|
|
|
|
import leftArrow from "./white-left-arrow.svg"; |
|
|
|
import leftArrow from "./white-left-arrow.svg"; |
|
|
@ -33,72 +39,55 @@ const Offer = ({ products }) => { |
|
|
|
</button> |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{/* left */} |
|
|
|
{/* left */} |
|
|
|
{/* no-scrollbar */} |
|
|
|
<div className="w-10/12 flex flex-row items-center rounded-lg bg-white"> |
|
|
|
<div |
|
|
|
<Swiper |
|
|
|
className="tabbar overflow-x-scroll scrolling-touch w-10/12 flex flex-row items-center rounded-lg bg-white" |
|
|
|
// spaceBetween={0}
|
|
|
|
onMouseDown={(e) => { |
|
|
|
slidesPerView={5} |
|
|
|
const slider = window.document.querySelector(".tabbar"); |
|
|
|
navigation |
|
|
|
window.isDown = true; |
|
|
|
pagination={{ clickable: true }} |
|
|
|
window.startX = e.pageX - slider.offsetLeft; |
|
|
|
scrollbar={{ draggable: true }} |
|
|
|
window.scrollLeft = slider.scrollLeft; |
|
|
|
onSlideChange={() => console.log("slide change")} |
|
|
|
}} |
|
|
|
onSwiper={(swiper) => console.log(swiper)} |
|
|
|
onMouseLeave={(e) => { |
|
|
|
> |
|
|
|
window.isDown = false; |
|
|
|
{/* */} |
|
|
|
}} |
|
|
|
{products.map((product, index) => ( |
|
|
|
onMouseUp={(e) => { |
|
|
|
<SwiperSlide> |
|
|
|
window.isDown = false; |
|
|
|
<div className="flex flex-col p-2"> |
|
|
|
}} |
|
|
|
<img src={product.image} className="rounded" /> |
|
|
|
onMouseMove={(e) => { |
|
|
|
<div className="flex flex-row justify-between items-center mt-4"> |
|
|
|
const slider = window.document.querySelector(".tabbar"); |
|
|
|
<p className="text-xs text-white bg-red-600 px-2 py-0.5 rounded-lg mr-1"> |
|
|
|
if (!window.isDown) return; |
|
|
|
{product.discount} |
|
|
|
e.preventDefault(); |
|
|
|
<span className="">%</span> |
|
|
|
const x = e.pageX - slider.offsetLeft; |
|
|
|
</p> |
|
|
|
const walk = (x - window.startX) * 1; |
|
|
|
<div className="flex flex-row items-center"> |
|
|
|
slider.scrollLeft = window.scrollLeft - walk; |
|
|
|
<p className="text-sm ml-1">{product.price}</p> |
|
|
|
}} |
|
|
|
<div className="relative"> |
|
|
|
> |
|
|
|
<span className="text-xs">توما</span> |
|
|
|
{products.map((product, index) => ( |
|
|
|
<span className="text-xs absolute left-0.5 -top-2"> |
|
|
|
<div |
|
|
|
ن |
|
|
|
className="flex flex-col p-2" |
|
|
|
</span> |
|
|
|
aria-current="page" |
|
|
|
</div> |
|
|
|
onClick={(e) => { |
|
|
|
</div> |
|
|
|
if (window.isDown) return e.preventDefault(); |
|
|
|
</div> |
|
|
|
///do here
|
|
|
|
<p |
|
|
|
}} |
|
|
|
className="text-left text-xs line-through my-2 ml-3" |
|
|
|
> |
|
|
|
style={{ color: "#c0c2c5" }} |
|
|
|
<img src={product.image} className="rounded w-40" /> |
|
|
|
> |
|
|
|
<div className="flex flex-row justify-between items-center mt-4"> |
|
|
|
{product.discountPrice} |
|
|
|
{/* right */} |
|
|
|
</p> |
|
|
|
<p className="text-xs text-white bg-red-600 px-2 py-0.5 rounded-lg mr-1"> |
|
|
|
<div className="bg-gray-200 h-1.5 mx-auto rounded mt-2 flex flex-row-reverse w-11/12"> |
|
|
|
{product.discount} |
|
|
|
<div |
|
|
|
<span className="">%</span> |
|
|
|
className={`h-1.5 rounded duration-500`} |
|
|
|
</p> |
|
|
|
style={{ |
|
|
|
{/* left */} |
|
|
|
width: product.rangeWidth, |
|
|
|
<div className="flex flex-row items-center"> |
|
|
|
backgroundColor: "#ef3a4f", |
|
|
|
<p className="text-sm ml-1">{product.price}</p> |
|
|
|
}} |
|
|
|
<div className="relative"> |
|
|
|
></div> |
|
|
|
<span className="text-xs">توما</span> |
|
|
|
|
|
|
|
<span className="text-xs absolute left-0.5 -top-2">ن</span> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</SwiperSlide> |
|
|
|
<p |
|
|
|
))} |
|
|
|
className="text-left text-xs line-through my-2 ml-3" |
|
|
|
</Swiper> |
|
|
|
style={{ color: "#c0c2c5" }} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{product.discountPrice} |
|
|
|
|
|
|
|
</p> |
|
|
|
|
|
|
|
<div className="bg-gray-200 h-1.5 mx-auto rounded mt-2 flex flex-row-reverse w-10/12"> |
|
|
|
|
|
|
|
<div |
|
|
|
|
|
|
|
className={`h-1.5 rounded duration-500`} |
|
|
|
|
|
|
|
style={{ |
|
|
|
|
|
|
|
width: product.rangeWidth, |
|
|
|
|
|
|
|
backgroundColor: "#ef3a4f", |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
></div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
))} |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</section> |
|
|
|
</section> |
|
|
|