Skip to content

Commit

Permalink
Search form tweaks; infinite scroll tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshschuler committed Jun 1, 2023
1 parent 1519b6e commit 367caea
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions frontend/src/components/SearchForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class="p-6 bg-white dark:bg-dark-200 shadow-lg rounded-xl absolute bottom-0 border-2 border-black"
>
<div class="flex flex-row p-4 <lg:flex-col">
<div class="flex flex-col min-w-xs mr-6 <lg:w-full">
<!-- <div class="flex flex-col min-w-xs mr-6 <lg:w-full">
<label for="location--select" class="mb-2 font-semibold">Location</label>
<select
id="location-select"
Expand All @@ -13,7 +13,7 @@
>
<option selected value="san-diego">San Diego</option>
</select>
</div>
</div> -->
<div class="flex flex-col w-full <lg:mt-4 relative">
<label for="search-input" class="mb-2 font-semibold">Search Trainers</label>
<input
Expand Down Expand Up @@ -59,11 +59,13 @@ function debounce(func: Function, timeout = 500) {
function handleScroll() {
throttle(() => {
// TODO: this seems too sensitive
const endOfPage = window.innerHeight + window.pageYOffset >= document.body.offsetHeight;
const container = document.getElementById("trainers--container");
if (container) {
const { scrollTop, scrollHeight, clientHeight } = container;
if (endOfPage) {
store.loadNextPage();
if (scrollTop + clientHeight >= scrollHeight - 5) {
store.loadNextPage();
}
}
}, 1000);
}
Expand Down

0 comments on commit 367caea

Please sign in to comment.