Skip to content

Commit

Permalink
fix(MonthView): fix issue where month data was not displayed when scr…
Browse files Browse the repository at this point in the history
…olling at the bottom of a budget with lots of categories

fix #52
  • Loading branch information
Xiphe committed Aug 24, 2020
1 parent 007eadf commit b491af8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/InfiniteSlider/InfiniteSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useVisibilityObserver, IsVisibleProvider } from '../../lib';
export type ScrollTo = (scrollTo: number, behaviour?: ScrollBehavior) => void;

type Props = {
style?: React.HTMLAttributes<HTMLDivElement>['style'];
innerRef: MutableRefObject<HTMLDivElement | null>;
syncScrollY: MutableRefObject<HTMLDivElement | null>;
getScrollTo?: (scrollTo: ScrollTo) => void;
Expand All @@ -26,6 +27,7 @@ const LOAD_MORE_THRESHOLD = 500;

export default function InfiniteSlider({
children,
style,
innerRef: containerRef,
getScrollTo,
loadMore,
Expand Down Expand Up @@ -91,6 +93,7 @@ export default function InfiniteSlider({
return (
<div
ref={containerRef}
style={style}
className={classNames(className, styles.slider)}
onScroll={onScroll}
>
Expand Down
7 changes: 7 additions & 0 deletions src/views/Budget/Budget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ export default function Budget({ state, dispatch }: Props) {
categories={categories || []}
/>
<InfiniteSlider
style={
sidebarRef.current
? ({
'--sidebar-height': `${sidebarRef.current.scrollHeight}px`,
} as any)
: undefined
}
innerRef={sliderRef}
onScrollRef={onSliderScrollRef}
className={styles.budgetSlider}
Expand Down
1 change: 1 addition & 0 deletions src/views/Month/Month.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
min-height: calc(100vh - var(--header-height));
min-width: calc(100vw - var(--sidebar-width));
max-width: calc(100vw - var(--sidebar-width));
height: var(--sidebar-height, 'auto');
@media (min-width: 800px) {
min-width: calc(calc(100vw - var(--sidebar-width)) / 2);
max-width: calc(calc(100vw - var(--sidebar-width)) / 2);
Expand Down

0 comments on commit b491af8

Please sign in to comment.