Skip to content

Commit 5c4c646

Browse files
feat(popover): add prop for disabling scroll
1 parent 43b3db3 commit 5c4c646

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

packages/clay-popover/src/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ interface IProps extends React.HTMLAttributes<HTMLDivElement> {
2424
*/
2525
alignPosition?: typeof ALIGN_POSITIONS[number];
2626

27+
/**
28+
* Flag to indicate if container should not be scrollable
29+
*/
30+
disableScroll?: boolean;
31+
2732
/**
2833
* Flag to indicate if tooltip is displayed.
2934
*/
@@ -41,6 +46,7 @@ const ClayPopover = React.forwardRef<HTMLDivElement, IProps>(
4146
alignPosition = 'bottom',
4247
children,
4348
className,
49+
disableScroll = false,
4450
header,
4551
show,
4652
...otherProps
@@ -60,7 +66,9 @@ const ClayPopover = React.forwardRef<HTMLDivElement, IProps>(
6066
>
6167
<div className="arrow" />
6268

63-
<div className="inline-scroller">
69+
<div
70+
className={classNames({'inline-scroller': !disableScroll})}
71+
>
6472
{header && <div className="popover-header">{header}</div>}
6573

6674
<div className="popover-body">{children}</div>

packages/clay-popover/stories/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import '@clayui/css/lib/css/atlas.css';
88
import ClayPopover from '../src';
99
import React from 'react';
10-
import {select} from '@storybook/addon-knobs';
10+
import {boolean, select} from '@storybook/addon-knobs';
1111
import {storiesOf} from '@storybook/react';
1212

1313
const positions = [
@@ -30,9 +30,16 @@ storiesOf('Components|ClayPopover', module).add('popover', () => (
3030
alignPosition={
3131
select('Align Position', positions, 'bottom') as 'bottom'
3232
}
33+
disableScroll={boolean('Disable Scroll', false)}
3334
header="Popover"
3435
>
3536
{`Viennese flavour cup eu, percolator froth ristretto mazagran
37+
caffeine. White roast seasonal, mocha trifecta, dripper caffeine
38+
spoon acerbic to go macchiato strong. Viennese flavour cup eu, percolator froth ristretto mazagran
39+
caffeine. White roast seasonal, mocha trifecta, dripper caffeine
40+
spoon acerbic to go macchiato strong. Viennese flavour cup eu, percolator froth ristretto mazagran
41+
caffeine. White roast seasonal, mocha trifecta, dripper caffeine
42+
spoon acerbic to go macchiato strong. Viennese flavour cup eu, percolator froth ristretto mazagran
3643
caffeine. White roast seasonal, mocha trifecta, dripper caffeine
3744
spoon acerbic to go macchiato strong.`}
3845
</ClayPopover>

0 commit comments

Comments
 (0)