Skip to content

Commit 3fa4cf7

Browse files
TESTING STORY (REMOVE BEFORE MERGE)
1 parent d079f92 commit 3fa4cf7

File tree

1 file changed

+80
-3
lines changed

1 file changed

+80
-3
lines changed

packages/eui/src/components/provider/provider.stories.tsx

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66
* Side Public License, v 1.
77
*/
88

9-
import React from 'react';
9+
import React, { useState } from 'react';
1010
import type { Meta, StoryObj } from '@storybook/react';
11-
import { SPREAD_STORY_ARGS_MARKER } from '../../../.storybook/addons/code-snippet/constants';
1211

13-
import { EuiPanel } from '../panel';
12+
import { EuiButton, EuiButtonEmpty } from '../button';
1413
import { EuiCode } from '../code';
14+
import { EuiPanel } from '../panel';
15+
import { EuiPopover } from '../popover';
16+
import { SPREAD_STORY_ARGS_MARKER } from '../../../.storybook/addons/code-snippet/constants';
1517

1618
import { EuiProvider, EuiProviderProps } from './provider';
19+
import { EuiToolTip } from '../tool_tip';
1720

1821
const meta: Meta<EuiProviderProps<{}>> = {
1922
title: 'Theming/EuiProvider',
@@ -121,3 +124,77 @@ export const FontDefaultUnits: Story = {
121124
</>
122125
),
123126
};
127+
128+
export const ComponentDefaultsPopover: Story = {
129+
parameters: {
130+
controls: {
131+
include: ['componentDefaults'],
132+
},
133+
},
134+
args: {
135+
componentDefaults: {
136+
EuiPopover: {
137+
repositionOnScroll: true,
138+
},
139+
},
140+
},
141+
render: function Render() {
142+
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
143+
144+
const openPopover = () => setIsPopoverOpen(true);
145+
146+
const closePopover = () => setIsPopoverOpen(false);
147+
148+
const button = (
149+
<EuiButtonEmpty iconType="help" iconSide="right" onClick={openPopover}>
150+
Show fixed popover
151+
</EuiButtonEmpty>
152+
);
153+
154+
return (
155+
<div style={{ position: 'relative', overflowY: 'auto', height: '100%' }}>
156+
<div style={{ height: 1200 }}>
157+
<EuiPopover
158+
button={button}
159+
isOpen={isPopoverOpen}
160+
closePopover={closePopover}
161+
style={{ position: 'fixed', bottom: 32, right: 32, zIndex: 10 }}
162+
>
163+
<div>This popover scrolls with the button element!</div>
164+
</EuiPopover>
165+
</div>
166+
</div>
167+
);
168+
},
169+
};
170+
171+
export const ComponentDefaultsTooltip: Story = {
172+
parameters: {
173+
controls: {
174+
include: ['componentDefaults'],
175+
},
176+
},
177+
args: {
178+
componentDefaults: {
179+
EuiToolTip: {
180+
repositionOnScroll: true,
181+
},
182+
},
183+
},
184+
render: function Render() {
185+
return (
186+
<div style={{ position: 'relative', overflowY: 'auto', height: '100%' }}>
187+
<div style={{ height: 1200 }}>
188+
<div style={{ position: 'fixed', bottom: 32, right: 32, zIndex: 10 }}>
189+
<EuiToolTip
190+
position="top"
191+
content="This tooltip text scrolls with the button element!"
192+
>
193+
<EuiButton fill>Show fixed tooltip</EuiButton>
194+
</EuiToolTip>
195+
</div>
196+
</div>
197+
</div>
198+
);
199+
},
200+
};

0 commit comments

Comments
 (0)