-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fc04c3
commit 392558e
Showing
8 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Image from "next/image"; | ||
|
||
interface InfoCardProps { | ||
title: string; | ||
description: string; | ||
img: string; | ||
} | ||
|
||
export const InfoCard = ({ title, description, img }: InfoCardProps) => { | ||
return ( | ||
<article className="w-full flex flex-col items-center gap-y-1 border border-primary-lm"> | ||
<Image src={img} width={85} height={85} alt={description} /> | ||
<div className="flex flex-col items-center gap-y-1 flex-1 border border-green"> | ||
<h3 className="text-primary-lm font-bold text-lg ms:text-xl md:text-2xl"> | ||
{title} | ||
</h3> | ||
<p className="text-center w-4/5 text-base md:text-lg text-black/55"> | ||
{description} | ||
</p> | ||
</div> | ||
</article> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { PAYMENT_METHODS } from "@/lib/constants"; | ||
import { InfoCard } from "./InfoCard"; | ||
|
||
export const PaymentMethodsDesktop = () => { | ||
return ( | ||
<> | ||
{PAYMENT_METHODS.map((item) => ( | ||
<InfoCard | ||
title={item.title} | ||
description={item.description} | ||
img={item.img} | ||
key={item.title} | ||
/> | ||
))} | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
"use client"; | ||
|
||
import { useKeenSlider } from "keen-slider/react"; | ||
import "keen-slider/keen-slider.min.css"; | ||
|
||
import { PAYMENT_METHODS } from "@/lib/constants"; | ||
import { InfoCard } from "./InfoCard"; | ||
|
||
export const PaymentMethodsMobile = () => { | ||
const [sliderRef] = useKeenSlider<HTMLDivElement>( | ||
{ | ||
loop: true, | ||
}, | ||
[ | ||
(slider) => { | ||
let timeout: ReturnType<typeof setTimeout>; | ||
let mouseOver = false; | ||
function clearNextTimeout() { | ||
clearTimeout(timeout); | ||
} | ||
function nextTimeout() { | ||
clearTimeout(timeout); | ||
if (mouseOver) return; | ||
timeout = setTimeout(() => { | ||
slider.next(); | ||
}, 4000); | ||
} | ||
slider.on("created", () => { | ||
slider.container.addEventListener("mouseover", () => { | ||
mouseOver = true; | ||
clearNextTimeout(); | ||
}); | ||
slider.container.addEventListener("mouseout", () => { | ||
mouseOver = false; | ||
nextTimeout(); | ||
}); | ||
nextTimeout(); | ||
}); | ||
slider.on("dragStarted", clearNextTimeout); | ||
slider.on("animationEnded", nextTimeout); | ||
slider.on("updated", nextTimeout); | ||
}, | ||
] | ||
); | ||
|
||
return ( | ||
<div ref={sliderRef} className="keen-slider"> | ||
{PAYMENT_METHODS.map((item) => ( | ||
<div key={item.title} className="keen-slider__slide"> | ||
<InfoCard | ||
title={item.title} | ||
description={item.description} | ||
img={item.img} | ||
/> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"use client"; | ||
|
||
import useMobile from "@/hooks/useMobile"; | ||
|
||
import { PaymentMethodsMobile } from "./PaymentMethodsMobile"; | ||
import { PaymentMethodsDesktop } from "./PaymentMethodsDesktop"; | ||
|
||
export const PaymentMethods = () => { | ||
const { isMobile } = useMobile(); | ||
|
||
return ( | ||
<section className="max-w-f-hd mx-auto p-4 ms:my-12 flex justify-start"> | ||
{isMobile ? <PaymentMethodsMobile /> : <PaymentMethodsDesktop />} | ||
</section> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters