Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiResizableContainer] Allow dynamic direction #4557

Merged
merged 9 commits into from
Feb 24, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Added support for all `color`s of `EuiPanel` ([#4504](https://github.com/elastic/eui/pull/4504))
- Added `hasBorder` prop to `EuiPanel` ([#4504](https://github.com/elastic/eui/pull/4504))
- Added `labelProps` prop to `EuiRadio`, `EuiSwitch` and `EuiCheckbox` ([#4516](https://github.com/elastic/eui/pull/4516))
- Allowed dynamically changing the `direction` prop on `EuiResizableContainer` ([#4557](https://github.com/elastic/eui/pull/4557))

**Bug fixes**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
EuiTitle,
EuiSpacer,
EuiPage,
EuiCode,
} from '../../../../src/components';
import { useIsWithinBreakpoints } from '../../../../src/services/hooks';
import { fake } from 'faker';
Expand Down Expand Up @@ -63,9 +64,7 @@ export default () => {
</EuiText>
<EuiSpacer />
<EuiPage paddingSize="none">
<EuiResizableContainer
direction={isMobile ? 'vertical' : 'horizontal'}
style={{ height: '400px' }}>
<EuiResizableContainer style={{ height: '320px' }}>
{(EuiResizablePanel, EuiResizableButton) => (
<>
<EuiResizablePanel
Expand All @@ -78,7 +77,7 @@ export default () => {
<EuiResizableButton />

<EuiResizablePanel mode="main" initialSize={80} minSize="50px">
<EuiPanel paddingSize="l" style={style}>
<EuiPanel paddingSize="l" style={{ minHeight: '100%' }}>
<EuiTitle>
<p>{itemSelected.label}</p>
</EuiTitle>
Expand Down Expand Up @@ -165,6 +164,46 @@ export default () => {
)}
</EuiResizableContainer>
</EuiPage>

<EuiSpacer />
<EuiText>
<h3>Responsive</h3>
<p>
It is possible to dynamically change the <EuiCode>direction</EuiCode>{' '}
prop to allow for adapting layouts to screen size. Resize the window
to see the panel orientation change.
</p>
</EuiText>
<EuiSpacer />
thompsongl marked this conversation as resolved.
Show resolved Hide resolved

<EuiPage paddingSize="none">
<EuiResizableContainer
direction={isMobile ? 'vertical' : 'horizontal'}
style={{ height: '400px' }}>
{(EuiResizablePanel, EuiResizableButton) => (
<>
<EuiResizablePanel
mode="collapsible"
initialSize={20}
minSize="10%">
<EuiListGroup flush>{itemElements}</EuiListGroup>
</EuiResizablePanel>

<EuiResizableButton />

<EuiResizablePanel mode="main" initialSize={80} minSize="50px">
<EuiPanel paddingSize="l" style={style}>
<EuiTitle>
<p>{itemSelected.label}</p>
</EuiTitle>
<EuiSpacer />
<EuiText>{itemSelected.text}</EuiText>
</EuiPanel>
</EuiResizablePanel>
</>
)}
</EuiResizableContainer>
</EuiPage>
</>
);
};