77 */
88
99import React from 'react' ;
10+ import { css } from '@emotion/react' ;
1011import type { Meta , StoryObj } from '@storybook/react' ;
1112import { faker } from '@faker-js/faker' ;
1213
1314import { enableFunctionToggleControls } from '../../../.storybook/utils' ;
1415import { EuiText } from '../text' ;
16+ import { useEuiContainerQuery } from '../../services/container_query' ;
1517import {
1618 EuiResizableContainer ,
1719 EuiResizableContainerProps ,
@@ -30,19 +32,37 @@ const placeholderText = (
3032const 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
4767const ThreeColumns : EuiResizableContainerProps [ 'children' ] = (
4868 EuiResizablePanel ,
0 commit comments