Skip to content

Commit

Permalink
feat: added scroll top on page changes (#2785)
Browse files Browse the repository at this point in the history
* feat: added scroll top on page changes

* fix: changelog

---------

Co-authored-by: Alon Peretz <[email protected]>
Co-authored-by: Tomer Shvadron <[email protected]>
  • Loading branch information
3 people authored Dec 2, 2024
1 parent a0d208a commit 85eea80
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 9 deletions.
6 changes: 6 additions & 0 deletions apps/backoffice-v2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@

- bump
- Updated dependencies
- @ballerine/react-pdf-toolkit@1.2.40
- @ballerine/workflow-browser-sdk@0.6.56
- @ballerine/workflow-node-sdk@0.6.56
- @ballerine/common@0.9.44
- @ballerine/ui@0.5.40
- @ballerine/blocks@0.2.24
- @ballerine/ui@0.5.43
- @ballerine/react-pdf-toolkit@1.2.43

Expand Down
3 changes: 3 additions & 0 deletions apps/kyb-app/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@

- bump
- Updated dependencies
- @ballerine/blocks@0.2.24
- @ballerine/common@0.9.44
- @ballerine/ui@0.5.43
- @ballerine/workflow-browser-sdk@0.6.56

## 0.3.75

Expand Down
21 changes: 20 additions & 1 deletion apps/kyb-app/src/components/layouts/AppShell/FormContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
import { usePageResolverContext } from '@/components/organisms/DynamicUI/PageResolver/hooks/usePageResolverContext';
import { AnyChildren, ScrollArea } from '@ballerine/ui';
import { useEffect, useRef } from 'react';

interface Props {
children: AnyChildren;
header?: AnyChildren;
}

export const FormContainer = ({ children, header }: Props) => {
const scrollAreaRef = useRef<HTMLDivElement>(null);

const { currentPage } = usePageResolverContext();

// Scrolls to top of the page when page changes
useEffect(() => {
if (scrollAreaRef.current) {
setTimeout(() => {
scrollAreaRef.current!.scrollTo({
top: 0,
behavior: 'smooth',
});
}, 100);
}
}, [currentPage]);

return (
<ScrollArea orientation="both" className="h-full">
//@ts-ignore
<ScrollArea orientation="both" className="h-full" ref={scrollAreaRef}>
<div className="text-secondary-foreground box-content flex flex-col gap-5 pl-40 pt-20">
{header ? <div>{header}</div> : null}
<div className="flex-flex-col w-full max-w-[385px]">{children}</div>
Expand Down
1 change: 1 addition & 0 deletions apps/workflows-dashboard/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

- bump
- Updated dependencies
- @ballerine/common@0.9.44
- @ballerine/common@0.9.45
- @ballerine/ui@0.5.40

Expand Down
2 changes: 2 additions & 0 deletions examples/headless-example/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@

- bump
- Updated dependencies
- @ballerine/workflow-browser-sdk@0.6.56
- @ballerine/common@0.9.44
- @ballerine/workflow-browser-sdk@0.6.57
- @ballerine/common@0.9.45

Expand Down
1 change: 1 addition & 0 deletions packages/blocks/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

- bump
- Updated dependencies
- @ballerine/common@0.9.44
- @ballerine/common@0.9.45

## 0.2.23
Expand Down
12 changes: 4 additions & 8 deletions packages/ui/src/components/atoms/ScrollArea/ScrollArea.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
import { ctw } from '@/common/utils/ctw';
import { ScrollBar } from '@/components/atoms';
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
import * as React from 'react';

interface Props extends ScrollAreaPrimitive.ScrollAreaProps {
orientation: 'vertical' | 'horizontal' | 'both';
Expand All @@ -11,12 +11,8 @@ export const ScrollArea = React.forwardRef<
React.ElementRef<React.FC<Props>>,
React.ComponentPropsWithoutRef<React.FC<Props>>
>(({ className, children, orientation, ...props }, ref) => (
<ScrollAreaPrimitive.Root
ref={ref}
className={ctw('relative overflow-hidden', className)}
{...props}
>
<ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
<ScrollAreaPrimitive.Root className={ctw('relative overflow-hidden', className)} {...props}>
<ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]" ref={ref}>
{children}
</ScrollAreaPrimitive.Viewport>
<ScrollBar orientation="vertical" />
Expand Down
2 changes: 2 additions & 0 deletions sdks/workflow-browser-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@

- bump
- Updated dependencies
- @ballerine/workflow-core@0.6.56
- @ballerine/common@0.9.44
- @ballerine/workflow-core@0.6.57
- @ballerine/common@0.9.45

Expand Down
3 changes: 3 additions & 0 deletions services/workflows-service/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@

- bump
- Updated dependencies
- @ballerine/workflow-core@0.6.56
- @ballerine/workflow-node-sdk@0.6.56
- @ballerine/common@0.9.44
- @ballerine/workflow-core@0.6.57
- @ballerine/workflow-node-sdk@0.6.57
- @ballerine/common@0.9.45
Expand Down

0 comments on commit 85eea80

Please sign in to comment.