slide 처리

This commit is contained in:
focp212@naver.com
2025-11-13 15:16:38 +09:00
parent bf2a3f7dcc
commit d5b9448ec4

View File

@@ -20,6 +20,7 @@ export const FavoriteWrapper = ({
}: FavoriteWrapperProps) => {
const { navigate } = useNavigate();
const { i18n, t } = useTranslation();
const [swiperInstance, setSwiperInstance] = useState<any>(null);
const { menuOn, setMenuOn } = useMenuOnStore();
const { favoriteEditOn, setFavoriteEditOn } = useFavoriteEditOnStore();
@@ -35,6 +36,12 @@ export const FavoriteWrapper = ({
programPath: '',
};
const goToLastSlide = () => {
if(swiperInstance){
swiperInstance.slideTo(swiperInstance.slides.length - 1);
}
};
const onClickToFavoriteEdit = () => {
setMenuOn(true);
setFavoriteEditOn(true);
@@ -130,12 +137,18 @@ export const FavoriteWrapper = ({
};
useEffect(() => {
goToLastSlide();
getFavoriteList();
}, [changeMenuId, favoriteEditOn]);
useEffect(() => {
goToLastSlide();
}, [menuIds]);
return (
<>
<Swiper
onSwiper={ setSwiperInstance }
spaceBetween={ 9 }
slidesPerView={ 4 }
style={{height: ((usingType === 'home') && (favoriteItems.length < 1))? '0px': '75px'}}