File size: 1,168 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
import { Panel, PanelBody, PanelRow } from '@wordpress/components';
import { ReactNode } from 'react';
function ScrollableContainer( { children }: { children: ReactNode } ) {
return (
<div
style={ {
width: 300,
height: 600,
overflowY: 'auto',
margin: 'auto',
boxShadow: '0 0 0 1px #ddd inset',
} }
>
{ children }
</div>
);
}
function Placeholder( { height = 200 } ) {
return <div style={ { background: '#ddd', height, width: '100%' } } />;
}
const PanelExample = () => (
<ScrollableContainer>
<Panel header="My Panel">
<PanelBody title="First Settings">
<PanelRow>
<Placeholder height={ 250 } />
</PanelRow>
</PanelBody>
<PanelBody title="Second Settings" initialOpen={ false }>
<PanelRow>
<Placeholder height={ 400 } />
</PanelRow>
</PanelBody>
<PanelBody title="Third Settings" initialOpen={ false }>
<PanelRow>
<Placeholder height={ 600 } />
</PanelRow>
</PanelBody>
<PanelBody title="Fourth Settings" initialOpen={ false }>
<PanelRow>
<Placeholder />
</PanelRow>
</PanelBody>
</Panel>
</ScrollableContainer>
);
export default PanelExample;
|