Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Commit

Permalink
feat: Added events and defer prop to SCrollArea
Browse files Browse the repository at this point in the history
  • Loading branch information
albinAppsmith committed Jun 21, 2024
1 parent d686bc2 commit bcf4e97
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/design-system/src/ScrollArea/ScrollArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,27 @@ import { ScrollAreaProps } from "./ScrollArea.types";

function ScrollArea(props: ScrollAreaProps) {
const ref = useRef<HTMLDivElement>(null);
const { children, className, options, size = "md", ...rest } = props;
const {
children,
className,
defer,
events,
options,
size = "md",
...rest
} = props;
const defaultOptions: UseOverlayScrollbarsParams["options"] = {
scrollbars: {
theme: "ads-v2-scroll-theme",
autoHide: "scroll",
},
...options,
};
const [initialize] = useOverlayScrollbars({ options: defaultOptions });
const [initialize] = useOverlayScrollbars({
options: defaultOptions,
events,
defer,
});

useEffect(() => {
if (ref.current) initialize(ref.current);
Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/ScrollArea/ScrollArea.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ import { Sizes } from "__config__/types";
export interface ScrollAreaProps extends React.HTMLAttributes<HTMLDivElement> {
size?: Extract<Sizes, "sm" | "md">;
options?: UseOverlayScrollbarsParams["options"];
events?: UseOverlayScrollbarsParams["events"];
defer?: UseOverlayScrollbarsParams["defer"];
}

0 comments on commit bcf4e97

Please sign in to comment.