Skip to content

Commit f4294f9

Browse files
author
Kubit
committed
Include swipe on drawer and tooltip components
1 parent 4a75ec3 commit f4294f9

File tree

15 files changed

+87
-304
lines changed

15 files changed

+87
-304
lines changed

src/components/drawer/drawerControlled.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ const DrawerControlledComponent = React.forwardRef(
3030
ref: React.ForwardedRef<HTMLDivElement> | undefined | null
3131
): JSX.Element => {
3232
useDeviceHeight();
33+
34+
const handleScroll = (e: Event) => {
35+
props.onContentScroll?.(e);
36+
};
37+
3338
const styles = useStylesV2<DrawerVariantStylesType, V>({
3439
styleName: STYLES_NAME.DRAWER,
3540
variantName: props.variant,
@@ -41,6 +46,7 @@ const DrawerControlledComponent = React.forwardRef(
4146
const { scrollableRef, shadowRef } = useScrollEffect({
4247
shadowStyles: stylesByDevice.titleContainer?.box_shadow,
4348
shadowVisible: SCROLL_DISTANCE,
49+
scrollCallback: handleScroll,
4450
});
4551

4652
const footerRef = useZoomEffect(FOOTER_EDIT_STYLES, MAX_ZOOM);
@@ -49,9 +55,9 @@ const DrawerControlledComponent = React.forwardRef(
4955
<DrawerStandAlone
5056
{...props}
5157
ref={ref}
58+
contentRef={scrollableRef}
5259
device={device}
5360
footerRef={footerRef}
54-
scrollableRef={scrollableRef}
5561
shadowRef={shadowRef}
5662
styles={stylesByDevice}
5763
/>

src/components/drawer/drawerStandAlone.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { IDrawerStandAlone } from './types';
2020
const DrawerStandAloneComponent = (
2121
{
2222
blocked = false,
23-
scrollableRef,
2423
shadowRef,
2524
footerRef,
2625
contentRef,
@@ -61,11 +60,7 @@ const DrawerStandAloneComponent = (
6160
/>
6261
</DrawerNavigationStyled>
6362
)}
64-
<DrawerTitleContentFooterContainerStyled
65-
ref={contentRef}
66-
blocked={blocked}
67-
styles={props.styles}
68-
>
63+
<DrawerTitleContentFooterContainerStyled blocked={blocked} styles={props.styles}>
6964
<DrawerTitleStyled
7065
ref={shadowRef}
7166
as={Text as unknown as React.ElementType}
@@ -77,7 +72,7 @@ const DrawerStandAloneComponent = (
7772
>
7873
{props.title?.content}
7974
</DrawerTitleStyled>
80-
<DrawerContentStyled ref={scrollableRef} styles={props.styles}>
75+
<DrawerContentStyled ref={contentRef} styles={props.styles}>
8176
{props.children}
8277
</DrawerContentStyled>
8378
{props.footer?.content && props.styles.footer?.variant && (

src/components/drawer/drawerUnControlled.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const DrawerUnControlledComponent = <V extends string | unknown>(
2424
closeIcon?.onClick?.(e);
2525
};
2626

27-
const handlePopoverCloseInterllay = () => {
27+
const handlePopoverCloseInternally = () => {
2828
handleCloseDrawer();
2929
popover?.onCloseInternally?.();
3030
};
@@ -35,7 +35,7 @@ const DrawerUnControlledComponent = <V extends string | unknown>(
3535
ref={ref}
3636
closeIcon={{ ...closeIcon, onClick: handleCloseIconClick }}
3737
open={open}
38-
popover={{ ...popover, onCloseInternally: handlePopoverCloseInterllay }}
38+
popover={{ ...popover, onCloseInternally: handlePopoverCloseInternally }}
3939
/>
4040
);
4141
};

src/components/drawer/stories/argtypes.ts

Lines changed: 0 additions & 162 deletions
This file was deleted.

src/components/drawer/stories/controlledArgtypes.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,16 @@ export const argtypes = (variants: IThemeObjectVariants, themeSelected: string):
126126
category: CATEGORY_CONTROL.MODIFIERS,
127127
},
128128
},
129+
onContentScroll: {
130+
description: 'Function to handle scroll event',
131+
type: { name: 'function' },
132+
table: {
133+
type: {
134+
summary: 'function',
135+
},
136+
category: CATEGORY_CONTROL.FUNCTIONS,
137+
},
138+
},
129139
dataTestId: {
130140
description: 'String used for testing',
131141
control: { type: 'text' },

src/components/drawer/stories/drawer.stories.tsx

Lines changed: 0 additions & 111 deletions
This file was deleted.

src/components/drawer/stories/drawerControlled.stories.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,14 @@ export const DrawerControlled: Story = {
7272
closeIcon: { icon: ICONS.ICON_CLOSE, altText: 'alt text icon', ['aria-label']: 'close icon' },
7373
level: DrawerLevelPositionTypes.FIRST_LEVEL,
7474
open: false,
75-
children: <ReplaceContent />,
75+
children: (
76+
<>
77+
<ReplaceContent />
78+
<ReplaceContent />
79+
<ReplaceContent />
80+
<ReplaceContent />
81+
</>
82+
),
7683
blocked: false,
7784
popover: {
7885
blockBack: true,

0 commit comments

Comments
 (0)