Skip to content

Commit

Permalink
fix: prevent scrolling to View all button
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Bedon committed Nov 19, 2024
1 parent d01f96f commit 84b0bb3
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/components/MyKiva/BorrowerCarousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,12 @@ const carousel = ref(null);
const tabs = ref(null);
const windowWidth = ref(0);
const openWhatIsNext = ref(false);
const lastVisitedLoanIdx = ref(0);
const hasActiveLoans = computed(() => {
return loans.value.some(loan => [FUNDED, FUNDRAISING, PAYING_BACK, RAISED].includes(loan?.status));
});
const handleChange = event => {
emit('selected-loan', loans.value[event]);
carousel.value.goToSlide(event);
};
const getBorrowerName = loan => {
return loan?.name ?? '';
};
Expand Down Expand Up @@ -218,6 +214,16 @@ const filteredLoans = computed(() => {
return loans.value.filter(loan => [FUNDED, FUNDRAISING, PAYING_BACK, RAISED].includes(loan?.status)).slice(0, 9);
});
const handleChange = event => {
if (event < filteredLoans.value.length) {
emit('selected-loan', loans.value[event]);
carousel.value.goToSlide(event);
lastVisitedLoanIdx.value = event;
} else {
tabs.value.tabContext.selectedIndex = lastVisitedLoanIdx.value;
}
};
const singleSlideWidth = computed(() => {
const viewportWidth = typeof window !== 'undefined' ? windowWidth.value : 520;
Expand Down

0 comments on commit 84b0bb3

Please sign in to comment.