Skip to content

Commit 8efe389

Browse files
committed
[REVERT] Manual testing story
1 parent 5bfd0e2 commit 8efe389

1 file changed

Lines changed: 33 additions & 13 deletions

File tree

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

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
*/
88

99
import React from 'react';
10+
import { css } from '@emotion/react';
1011
import type { Meta, StoryObj } from '@storybook/react';
1112
import { faker } from '@faker-js/faker';
1213

1314
import { enableFunctionToggleControls } from '../../../.storybook/utils';
1415
import { EuiText } from '../text';
16+
import { useEuiContainerQuery } from '../../services/container_query';
1517
import {
1618
EuiResizableContainer,
1719
EuiResizableContainerProps,
@@ -30,19 +32,37 @@ const placeholderText = (
3032
const TwoColumns: EuiResizableContainerProps['children'] = (
3133
EuiResizablePanel,
3234
EuiResizableButton
33-
) => (
34-
<>
35-
<EuiResizablePanel initialSize={50} tabIndex={0}>
36-
<EuiText>{placeholderText}</EuiText>
37-
</EuiResizablePanel>
38-
39-
<EuiResizableButton accountForScrollbars="both" />
40-
41-
<EuiResizablePanel initialSize={50} tabIndex={0}>
42-
<EuiText>{placeholderText}</EuiText>
43-
</EuiResizablePanel>
44-
</>
45-
);
35+
) => {
36+
const containerRef = React.useRef<HTMLDivElement>(null);
37+
const matches = useEuiContainerQuery(containerRef, '(inline-size > 400px)');
38+
39+
return (
40+
<>
41+
<EuiResizablePanel
42+
initialSize={50}
43+
tabIndex={0}
44+
css={css`
45+
container-type: inline-size;
46+
outline: 1px dashed;
47+
`}
48+
>
49+
<div ref={containerRef}>
50+
<EuiText color={matches ? 'success' : 'default'}>
51+
{matches
52+
? 'Container width is greater than 400px'
53+
: placeholderText}
54+
</EuiText>
55+
</div>
56+
</EuiResizablePanel>
57+
58+
<EuiResizableButton accountForScrollbars="both" />
59+
60+
<EuiResizablePanel initialSize={50} tabIndex={0}>
61+
<EuiText>{placeholderText}</EuiText>
62+
</EuiResizablePanel>
63+
</>
64+
);
65+
};
4666

4767
const ThreeColumns: EuiResizableContainerProps['children'] = (
4868
EuiResizablePanel,

0 commit comments

Comments
 (0)