Skip to content

Commit

Permalink
Merge pull request #5697 from kiva/prevent-scrolling-when-view-all-bu…
Browse files Browse the repository at this point in the history
…tton-is-clicked

fix: prevent scrolling to View all button
  • Loading branch information
christian14b authored Nov 19, 2024
2 parents b3bea0e + 84b0bb3 commit 2b7671c
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 2b7671c

Please sign in to comment.