-
Notifications
You must be signed in to change notification settings - Fork 885
[EuiSplitPanel] New component #4539
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
Merged
Merged
Changes from 14 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
e8bb6b5
Adding `EuiSplitPanel` (using render props… meh)
24c85a0
Changing the split panel behavior
2de92ff
Added docs example section
3ac66ca
Changing again the way the component is setup
efab3a1
Adding `direction` and `responsive` props
1286875
Update docs text
80379bc
Merge branch 'master' into new/split_panel
cchaos e22ace2
Merge remote-tracking branch upstream/master into new/split_panel
154c3e5
Update types
5d38479
Merge remote-tracking branch 'upstream/master' into new/split_panel
680af56
cl
95048ee
Quick update to docs text
55d56c3
Change doc example to from TS to JS
6a7c80b
Cleanup a border style
a9679b9
Merge branch 'master' into new/split_panel
cchaos 385b6dc
Exporting props and fixing prop comment
1bc8e15
Merge branch 'master' into new/split_panel
cchaos 82821ed
Adjust responsive language
4da5afe
Update src/components/panel/split_panel/split_panel.tsx
cchaos e4b9bf2
Merge branch 'master' into new/split_panel
cchaos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| import React from 'react'; | ||
| import { | ||
| EuiSpacer, | ||
| EuiFlexGroup, | ||
| EuiFlexItem, | ||
| EuiSplitPanel, | ||
| EuiText, | ||
| EuiCode, | ||
| } from '../../../../src/components'; | ||
|
|
||
| export default () => ( | ||
| <> | ||
| <EuiFlexGroup gutterSize="l"> | ||
| <EuiFlexItem> | ||
| <EuiSplitPanel.Outer grow> | ||
| <EuiSplitPanel.Inner> | ||
| <EuiText> | ||
| <p>Top panel</p> | ||
| </EuiText> | ||
| </EuiSplitPanel.Inner> | ||
| <EuiSplitPanel.Inner grow={false} color="subdued"> | ||
| <EuiText> | ||
| <p> | ||
| Bottom panel has <EuiCode>{'grow={false}'}</EuiCode> | ||
| </p> | ||
| </EuiText> | ||
| </EuiSplitPanel.Inner> | ||
| </EuiSplitPanel.Outer> | ||
| </EuiFlexItem> | ||
| <EuiFlexItem> | ||
| <EuiSplitPanel.Outer grow={false}> | ||
| <EuiSplitPanel.Inner> | ||
| <EuiText> | ||
| <p> | ||
| Outer panel has <EuiCode>{'grow={false}'}</EuiCode> | ||
| </p> | ||
| </EuiText> | ||
| </EuiSplitPanel.Inner> | ||
| <EuiSplitPanel.Inner grow={false} color="subdued"> | ||
| <EuiText> | ||
| <p>Bottom panel</p> | ||
| </EuiText> | ||
| </EuiSplitPanel.Inner> | ||
| </EuiSplitPanel.Outer> | ||
| </EuiFlexItem> | ||
| <EuiFlexItem> | ||
| <EuiSplitPanel.Outer> | ||
| <EuiSplitPanel.Inner> | ||
| <EuiText> | ||
| <p>Top panel</p> | ||
| </EuiText> | ||
| </EuiSplitPanel.Inner> | ||
| <EuiSplitPanel.Inner color="subdued"> | ||
| <EuiText> | ||
| <p>Middle panel</p> | ||
| </EuiText> | ||
| </EuiSplitPanel.Inner> | ||
| <EuiSplitPanel.Inner color="danger"> | ||
| <EuiText> | ||
| <p>Danger panel</p> | ||
| </EuiText> | ||
| </EuiSplitPanel.Inner> | ||
| </EuiSplitPanel.Outer> | ||
| </EuiFlexItem> | ||
| </EuiFlexGroup> | ||
| <EuiSpacer /> | ||
| <EuiSplitPanel.Outer direction="row"> | ||
| <EuiSplitPanel.Inner> | ||
| <EuiText> | ||
| <p>Left panel</p> | ||
| <p>Has more content</p> | ||
| </EuiText> | ||
| </EuiSplitPanel.Inner> | ||
| <EuiSplitPanel.Inner color="subdued"> | ||
| <EuiText> | ||
| <p>Right panel</p> | ||
| </EuiText> | ||
| </EuiSplitPanel.Inner> | ||
| </EuiSplitPanel.Outer> | ||
| </> | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| @import 'panel'; | ||
| @import './split_panel/index' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/components/panel/split_panel/__snapshots__/split_panel.test.tsx.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
|
||
| exports[`EuiSplitPanel accepts panel props 1`] = ` | ||
| <div | ||
| class="euiPanel euiPanel--borderRadiusMedium euiPanel--primary euiPanel--noShadow euiPanel--noBorder euiPanel--flexGrowZero euiSplitPanel" | ||
| > | ||
| <div | ||
| aria-label="aria-label" | ||
| class="euiPanel euiPanel--paddingMedium euiPanel--borderRadiusNone euiPanel--success euiPanel--noShadow euiPanel--noBorder euiSplitPanel__inner testClass1 testClass2" | ||
| data-test-subj="test subject string" | ||
| /> | ||
| </div> | ||
| `; | ||
|
|
||
| exports[`EuiSplitPanel inner children are rendered 1`] = ` | ||
| <div | ||
| class="euiPanel euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow euiPanel--flexGrowZero euiSplitPanel" | ||
| > | ||
| <div | ||
| class="euiPanel euiPanel--paddingMedium euiPanel--borderRadiusNone euiPanel--transparent euiPanel--noShadow euiPanel--noBorder euiSplitPanel__inner" | ||
| /> | ||
| </div> | ||
| `; | ||
|
|
||
| exports[`EuiSplitPanel is rendered 1`] = ` | ||
| <div | ||
| aria-label="aria-label" | ||
| class="euiPanel euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow euiPanel--flexGrowZero euiSplitPanel testClass1 testClass2" | ||
| data-test-subj="test subject string" | ||
| /> | ||
| `; | ||
|
|
||
| exports[`EuiSplitPanel renders as row 1`] = ` | ||
| <div | ||
| class="euiPanel euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow euiPanel--flexGrowZero euiSplitPanel euiSplitPanel--row" | ||
| /> | ||
| `; | ||
|
|
||
| exports[`EuiSplitPanel responsive can be changed to different breakpoints 1`] = ` | ||
| <div | ||
| class="euiPanel euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow euiPanel--flexGrowZero euiSplitPanel" | ||
| /> | ||
| `; | ||
|
|
||
| exports[`EuiSplitPanel responsive can be false 1`] = ` | ||
| <div | ||
| class="euiPanel euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow euiPanel--flexGrowZero euiSplitPanel" | ||
| /> | ||
| `; | ||
|
|
||
| exports[`EuiSplitPanel responsive is rendered at small screens 1`] = ` | ||
| <div | ||
| class="euiPanel euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow euiPanel--flexGrowZero euiSplitPanel" | ||
| /> | ||
| `; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| @import 'split_panel'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| .euiSplitPanel { | ||
| overflow: hidden; // Hide backgrounds within border-radius | ||
| display: flex; | ||
| flex-direction: column; | ||
| min-width: 0; | ||
|
|
||
| &--row { | ||
| flex-direction: row; | ||
|
|
||
| &.euiSplitPanel-isResponsive { | ||
| flex-direction: column; | ||
| } | ||
| } | ||
|
|
||
| .euiSplitPanel__inner { | ||
| flex-basis: 0%; // Make sure they're evenly split | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| export { EuiSplitPanel } from './split_panel'; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import React from 'react'; | ||
| import { render } from 'enzyme'; | ||
| import { requiredProps } from '../../../test/required_props'; | ||
|
|
||
| import { EuiSplitPanel } from './split_panel'; | ||
|
|
||
| describe('EuiSplitPanel', () => { | ||
| test('is rendered', () => { | ||
| const component = render(<EuiSplitPanel.Outer {...requiredProps} />); | ||
|
|
||
| expect(component).toMatchSnapshot(); | ||
| }); | ||
|
|
||
| describe('inner children', () => { | ||
| test('are rendered', () => { | ||
| const component = render( | ||
| <EuiSplitPanel.Outer> | ||
| <EuiSplitPanel.Inner /> | ||
| </EuiSplitPanel.Outer> | ||
| ); | ||
|
|
||
| expect(component).toMatchSnapshot(); | ||
| }); | ||
| }); | ||
|
|
||
| test('accepts panel props', () => { | ||
| const component = render( | ||
| <EuiSplitPanel.Outer color="primary"> | ||
| <EuiSplitPanel.Inner color="success" {...requiredProps} /> | ||
| </EuiSplitPanel.Outer> | ||
| ); | ||
|
|
||
| expect(component).toMatchSnapshot(); | ||
| }); | ||
|
|
||
| test('renders as row', () => { | ||
| const component = render(<EuiSplitPanel.Outer direction="row" />); | ||
|
|
||
| expect(component).toMatchSnapshot(); | ||
| }); | ||
|
|
||
| describe('responsive', () => { | ||
| // @ts-ignore innerWidth might be read only but we can still override it for the sake of testing | ||
| beforeAll(() => (window.innerWidth = 520)); | ||
| afterAll(() => 1024); // reset to jsdom's default | ||
|
|
||
| test('is rendered at small screens', () => { | ||
| const component = render(<EuiSplitPanel.Outer />); | ||
|
|
||
| expect(component).toMatchSnapshot(); | ||
| }); | ||
|
|
||
| test('can be false', () => { | ||
| const component = render(<EuiSplitPanel.Outer responsive={false} />); | ||
|
|
||
| expect(component).toMatchSnapshot(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('responsive', () => { | ||
| // @ts-ignore innerWidth might be read only but we can still override it for the sake of testing | ||
| beforeAll(() => (window.innerWidth = 1000)); | ||
| afterAll(() => 1024); // reset to jsdom's default | ||
|
|
||
| test('can be changed to different breakpoints', () => { | ||
| const component = render(<EuiSplitPanel.Outer responsive={['m', 'l']} />); | ||
|
|
||
| expect(component).toMatchSnapshot(); | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.