Skip to content

Commit

Permalink
feat: Adds open state as Tooltip prop
Browse files Browse the repository at this point in the history
  • Loading branch information
amir-zahedi committed Aug 9, 2023
1 parent e0b1a75 commit 978d331
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/overdrive/lib/components/StickyBox/StickyBox.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ export const root = style({
position: 'sticky',
transition: `box-shadow 0.3s ${vars.animation.easing.standard} 0s`,
});
export const simpleRoot = style({
position: 'sticky',
height: 'fit-content',
});

export const content = style({
height: 'fit-content',
Expand Down
16 changes: 15 additions & 1 deletion packages/overdrive/lib/components/StickyBox/StickyBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ interface Props extends ComponentProps<typeof Box> {
top?: 'none' | '1' | '2' | '3' | '5' | '7' | 'subHeader';
bottom?: 'none' | '1' | '2' | '3' | 'subHeader';
zIndex?: 0 | 1 | 2 | 3 | 99;
noPopShadow?: boolean;
className?: string;
}

export const StickyBox: FunctionComponent<Props> = ({
top = 'none',
bottom = 'none',
noPopShadow = false,
zIndex = 2,
className = '',
backgroundColour,
Expand All @@ -38,7 +40,19 @@ export const StickyBox: FunctionComponent<Props> = ({
return () => parentElement.removeEventListener('scroll', onScroll);
}, [containerRef.current?.parentElement]);

return (
return noPopShadow ? (
<Box
className={[
className,
styles.simpleRoot,
styles.top[top],
styles.zIndex[zIndex],
]}
{...rest}
>
{children}
</Box>
) : (
<Box
ref={containerRef}
overflow="hidden"
Expand Down
7 changes: 7 additions & 0 deletions packages/overdrive/lib/components/StickyBox/stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,10 @@ const standardProps: Props = {
};
export const standard = Template.bind(standardProps);
standard.args = standardProps;

const withNoPopShadowProps: Props = {
top: 'none',
noPopShadow: true,
};
export const withNoPopShadow = Template.bind(withNoPopShadowProps);
withNoPopShadow.args = withNoPopShadowProps;

0 comments on commit 978d331

Please sign in to comment.