Hide next/prev buttons if not usable

This commit is contained in:
Lncvrt committed 2026-07-29 12:33:46 -07:00
1 parent c1082e6741
commit 5f06db1339
1 file changed
+10
+10
View File
@@ -53,6 +53,7 @@ export default function HomePage () {
const swiperRef = useRef<SwiperType | null>(null)
const prevRef = useRef<HTMLButtonElement>(null)
const nextRef = useRef<HTMLButtonElement>(null)
const [isLocked, setIsLocked] = useState(false)
const [recentSlidesPerView, setRecentSlidesPerView] = useState(1)
@@ -90,6 +91,13 @@ export default function HomePage () {
className='w-full'
onSwiper={swiper => {
swiperRef.current = swiper
setIsLocked(swiper.isLocked)
}}
onResize={swiper => {
setIsLocked(swiper.isLocked)
}}
onUpdate={swiper => {
setIsLocked(swiper.isLocked)
}}
onBeforeInit={swiper => {
if (
@@ -142,6 +150,7 @@ export default function HomePage () {
)
})}
</Swiper>
{!isLocked && (
<div className='flex flex-row gap-2'>
<button
ref={prevRef}
@@ -158,6 +167,7 @@ export default function HomePage () {
<FontAwesomeIcon icon={faChevronRight} />
</button>
</div>
)}
</div>
)}
</div>