diff --git a/routes/_components/LoadingFooter.html b/routes/_components/LoadingFooter.html new file mode 100644 index 0000000..c9c3e39 --- /dev/null +++ b/routes/_components/LoadingFooter.html @@ -0,0 +1,26 @@ + + + \ No newline at end of file diff --git a/routes/_components/LoadingSpinner.html b/routes/_components/LoadingSpinner.html index fb2e844..c9ef996 100644 --- a/routes/_components/LoadingSpinner.html +++ b/routes/_components/LoadingSpinner.html @@ -1,10 +1,10 @@ - +
{{#each $visibleItems as item @key}} - + {{/each}} + {{#if $showFooter}} + + {{/if}}
\ No newline at end of file diff --git a/routes/_utils/virtualListStore.js b/routes/_utils/virtualListStore.js index d0f18ee..32b7ea7 100644 --- a/routes/_utils/virtualListStore.js +++ b/routes/_utils/virtualListStore.js @@ -42,6 +42,8 @@ class VirtualListStore extends Store { const virtualListStore = new VirtualListStore({ items: [], itemHeights: {}, + showFooter: false, + footerHeight: 0 }) virtualListStore.compute('visibleItems', @@ -79,7 +81,9 @@ virtualListStore.compute('visibleItems', return visibleItems }) -virtualListStore.compute('height', ['items', 'itemHeights'], (items, itemHeights) => { +virtualListStore.compute('heightWithoutFooter', + ['items', 'itemHeights'], + (items, itemHeights) => { let sum = 0 let i = -1 let len = items.length @@ -89,6 +93,13 @@ virtualListStore.compute('height', ['items', 'itemHeights'], (items, itemHeights return sum }) + +virtualListStore.compute('height', + ['heightWithoutFooter', 'showFooter', 'footerHeight'], + (heightWithoutFooter, showFooter, footerHeight) => { + return showFooter ? (heightWithoutFooter + footerHeight) : heightWithoutFooter +}) + virtualListStore.compute('numItems', ['items'], (items) => items.length) if (process.browser && process.env.NODE_ENV !== 'production') {