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

[EuiPageLayout] Add bottomBar & [EuiBottomBar] Add more position props #4662

Merged
merged 31 commits into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cde54f9
WIP adding more props
Mar 16, 2021
31f5749
Adding `position` and `usePortal` props
Mar 16, 2021
ffea7dd
Merge remote-tracking branch 'upstream/master' into feat/bottom_bar_i…
Mar 22, 2021
21e9a53
Restricted use of some props when position is fixed and moved positio…
Mar 22, 2021
d22a404
Fixing page header border depending on page body padding
Mar 22, 2021
61e3cd0
Adding `bottomBar` to EuiPageTemplate
Mar 22, 2021
860b627
Adding EUiPageContentBody wrapper on bottom bar contents to align res…
Mar 23, 2021
2451d7b
Change doc title to say page first
Mar 23, 2021
ee31a48
Adjusting bottomBar positioning attributes
Mar 23, 2021
48cb74b
Cleanup
Mar 23, 2021
01c125c
Adding main roles
Mar 24, 2021
0c42e68
Cleanup
Mar 24, 2021
ba40203
Merge remote-tracking branch 'upstream/master' into feat/bottom_bar_i…
Mar 24, 2021
b2cfea6
cl
Mar 24, 2021
570f49c
Updating bottom bar playground
Mar 24, 2021
24c35d5
Added note about page template in bottom bar docs
Mar 24, 2021
9dd0fbd
Merge remote-tracking branch 'upstream/master' into feat/bottom_bar_i…
Mar 29, 2021
a56e91b
Apply suggestions from code review
cchaos Mar 30, 2021
d7e7120
Merge branch 'master' into feat/bottom_bar_in_page
cchaos Mar 30, 2021
8583d9d
Moved role=main logic into EuiPageComponent
chandlerprall Mar 31, 2021
13c29cf
Merge pull request #47 from chandlerprall/feat/bottom_bar_in_page
cchaos Mar 31, 2021
16a9a5e
Merge remote-tracking branch 'upstream/master' into feat/bottom_bar_i…
Mar 31, 2021
d8c9ac9
Better extension of EuiPanel props in EuiPageContent and more tests
Mar 31, 2021
27544f3
test
Mar 31, 2021
20d412b
Remove test and force CI?
Mar 31, 2021
78305ea
cl
Mar 31, 2021
888b517
cl
Mar 31, 2021
ef38221
Merge remote-tracking branch 'upstream/master' into feat/bottom_bar_i…
Mar 31, 2021
b22c06a
Merge remote-tracking branch 'upstream/master' into feat/bottom_bar_i…
Mar 31, 2021
6122476
Fixing a11y
Apr 1, 2021
9f26af0
Remove footer element
Apr 1, 2021
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
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
## [`master`](https://github.com/elastic/eui/tree/master)

No public interface changes since `31.12.0`.
- Added `position`, `usePortal`, `top`, `right`, `bottom`, and `left` props to `EuiBottomBar` ([#4662](https://github.com/elastic/eui/pull/4662))
- Added `bottomBar` and `bottomBarProps` to `EuiPageTemplate` when `template = 'default'` ([#4662](https://github.com/elastic/eui/pull/4662))
- Added `role="main"` to the `EuiPageContent` component inside of `EuiPageTemplate` ([#4662](https://github.com/elastic/eui/pull/4662))
- Added `bottomBorder` props to `EuiPageHeader` ([#4662](https://github.com/elastic/eui/pull/4662))

**Breaking changes**

- Changed `EuiBottomBar` positioning styles from being applied at the CSS layer to the `style` property ([#4662](https://github.com/elastic/eui/pull/4662))

## [`31.12.0`](https://github.com/elastic/eui/tree/v31.12.0)

Expand Down
21 changes: 10 additions & 11 deletions src-docs/src/components/guide_page/guide_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,22 @@ const GuidePageComponent = ({
</EuiPageHeader>

<EuiPageContent
role="main"
hasShadow={false}
paddingSize="none"
color="transparent"
hasBorder={false}
borderRadius="none">
<EuiPageContentBody restrictWidth>
<main>
<Switch>
{playground && (
<Route path={`${match.path}/playground`}>{playground}</Route>
)}
{guidelines && (
<Route path={`${match.path}/guidelines`}>{guidelines}</Route>
)}
<Route path="">{children}</Route>
</Switch>
</main>
<Switch>
{playground && (
<Route path={`${match.path}/playground`}>{playground}</Route>
)}
{guidelines && (
<Route path={`${match.path}/guidelines`}>{guidelines}</Route>
)}
<Route path="">{children}</Route>
</Switch>
</EuiPageContentBody>
</EuiPageContent>
</>
Expand Down
5 changes: 4 additions & 1 deletion src-docs/src/components/guide_page/guide_page_chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,10 @@ export class GuidePageChrome extends Component {
direction="column"
responsive={false}
gutterSize="none">
<EuiFlexItem grow={false} className="guideSideNav__search">
<EuiFlexItem
role="search"
grow={false}
className="guideSideNav__search">
<EuiFieldSearch
fullWidth
placeholder="Search"
Expand Down
6 changes: 1 addition & 5 deletions src-docs/src/components/guide_section/guide_section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,7 @@ export const GuideSection: FunctionComponent<GuideSection> = ({
{renderingPlayground && renderPlayground()}
{!renderingPlayground && demo && (
<GuideSectionExample
example={
<EuiErrorBoundary>
<div>{demo}</div>
</EuiErrorBoundary>
}
example={<EuiErrorBoundary>{demo}</EuiErrorBoundary>}
tabs={renderTabs()}
ghostBackground={ghostBackground}
demoPanelProps={demoPanelProps}
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/app_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class AppView extends Component {
}

componentDidMount() {
document.title = `Elastic UI Framework - ${this.props.currentRoute.name}`;
document.title = `${this.props.currentRoute.name} - Elastic UI Framework`;
document.addEventListener('keydown', this.onKeydown);
}

Expand Down
6 changes: 3 additions & 3 deletions src-docs/src/views/bottom_bar/bottom_bar_displacement.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { useState } from 'react';
import {
EuiBottomBar,
EuiButtonGroup,
EuiButtonEmpty,
EuiButton,
EuiFlexGroup,
EuiFlexItem,
} from '../../../../src/components';
Expand Down Expand Up @@ -42,13 +42,13 @@ export default () => {
affordForDisplacement={toggleIdSelected === 'bottomBarStandard'}>
<EuiFlexGroup justifyContent="flexEnd">
<EuiFlexItem grow={false}>
<EuiButtonEmpty
<EuiButton
onClick={() => setToggleIdSelected(null)}
color="ghost"
size="s"
iconType="cross">
close
</EuiButtonEmpty>
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
</EuiBottomBar>
Expand Down
81 changes: 58 additions & 23 deletions src-docs/src/views/bottom_bar/bottom_bar_example.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
import React from 'react';

import { renderToHtml } from '../../services';
import { Link } from 'react-router-dom';

import { GuideSectionTypes } from '../../components';

import { EuiBottomBar, EuiCode } from '../../../../src/components';

import { bottomBarConfig } from './playground';

import BottomBar from './bottom_bar';
const bottomBarSource = require('!!raw-loader!./bottom_bar');
const bottomBarHtml = renderToHtml(BottomBar);

const bottomBarSnippet = `<EuiBottomBar paddingSize="s">
<!-- Content goes here -->
</EuiBottomBar>`;

import BottomBarDisplacement from './bottom_bar_displacement';
const bottomBarDisplacementSource = require('!!raw-loader!./bottom_bar_displacement');
const bottomBarDisplacementHtml = renderToHtml(BottomBarDisplacement);

const bottomBarDisplacementSnippet = `<EuiBottomBar affordForDisplacement={false}>
<!-- Content goes here -->
</EuiBottomBar>`;
import BottomBarPosition from './bottom_bar_position';
import { EuiCallOut } from '../../../../src/components/call_out';
const bottomBarPositionSource = require('!!raw-loader!./bottom_bar_position');

export const BottomBarExample = {
title: 'Bottom bar',
intro: (
<EuiCallOut>
<p>
<strong>EuiPageTemplate</strong> offers a quick way to{' '}
<Link to="/layout/page#showing-a-bottom-bar">
apply a bottom bar to your page layouts
</Link>
.
</p>
</EuiCallOut>
),
sections: [
{
source: [
{
type: GuideSectionTypes.JS,
code: bottomBarSource,
},
{
type: GuideSectionTypes.HTML,
code: bottomBarHtml,
},
],
text: (
<>
Expand All @@ -54,19 +56,49 @@ export const BottomBarExample = {
</>
),
props: { EuiBottomBar },
snippet: bottomBarSnippet,
demo: <BottomBar />,
playground: bottomBarConfig,
snippet: `<EuiBottomBar paddingSize="s">
<!-- Content goes here -->
</EuiBottomBar>`,
},
{
title: 'Displacement',
title: 'Positions',
source: [
{
type: GuideSectionTypes.JS,
code: bottomBarDisplacementSource,
code: bottomBarPositionSource,
},
],
text: (
<>
<p>
Bottom bars default to being fixed position, in a portal at the
bottom of the browser window. Alternatively, you can change the{' '}
<EuiCode>position</EuiCode> to <EuiCode>sticky</EuiCode> where it
will render in place but stick to the window only as the window edge
nears. The <EuiCode>static</EuiCode> position reverts back to
default DOM behavior.
</p>
<p>
You can also apply a different set of positioning locations just by
adjusting them in with the{' '}
<EuiCode>top | right | bottom | left</EuiCode> props.
</p>
</>
),
props: { EuiBottomBar },
demo: <BottomBarPosition />,
snippet: `<EuiBottomBar position="sticky" bottom={10}>
<!-- Content goes here -->
</EuiBottomBar>`,
},
{
title: 'Displacement',
source: [
{
type: GuideSectionTypes.HTML,
code: bottomBarDisplacementHtml,
type: GuideSectionTypes.JS,
code: bottomBarDisplacementSource,
},
],
text: (
Expand All @@ -75,15 +107,18 @@ export const BottomBarExample = {
There is an <EuiCode>affordForDisplacement</EuiCode> prop
(defaulting to <EuiCode>true</EuiCode>), which determines whether
the component makes room for itself by adding bottom padding
equivalent to its own height on the document body element. Setting
this to <EuiCode>false</EuiCode> can be useful to minimize scrollbar
equivalent to its own height on the document{' '}
<EuiCode language="html">{'<body>'}</EuiCode> element. Setting this
to <EuiCode>false</EuiCode> can be useful to minimize scrollbar
visibility but will cause the bottom bar to overlap body content.
</p>
</>
),
props: { EuiBottomBar },
snippet: bottomBarDisplacementSnippet,
demo: <BottomBarDisplacement />,
snippet: `<EuiBottomBar affordForDisplacement={false}>
<!-- Content goes here -->
</EuiBottomBar>`,
},
],
};
25 changes: 25 additions & 0 deletions src-docs/src/views/bottom_bar/bottom_bar_position.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';

import { EuiBottomBar, EuiSpacer, EuiText } from '../../../../src/components';

export default () => {
return (
<>
<EuiText>
<p>
When scrolling past this example block, the{' '}
<strong>EuiBottomBar</strong> will stick to the bottom of the browser
window (with a 10px offset), but keeps it within the bounds of its
parent.
</p>
</EuiText>
<EuiSpacer size="xl" />
<EuiSpacer size="xl" />
<EuiBottomBar position="sticky" bottom={10}>
<EuiText color="ghost" textAlign="center">
<p>Scroll to see!</p>
</EuiText>
</EuiBottomBar>
</>
);
};
54 changes: 54 additions & 0 deletions src-docs/src/views/bottom_bar/playground.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { PropTypes } from 'react-view';
import { EuiButton, EuiBottomBar } from '../../../../src/components/';
import { propUtilityForPlayground } from '../../services/playground';

export const bottomBarConfig = () => {
const docgenInfo = Array.isArray(EuiBottomBar.__docgenInfo)
? EuiBottomBar.__docgenInfo[0]
: EuiBottomBar.__docgenInfo;
const propsToUse = propUtilityForPlayground(docgenInfo.props);

propsToUse.children = {
type: PropTypes.ReactNode,
value: '<EuiButton color="ghost">Save</EuiButton>',
};

propsToUse.top = {
...propsToUse.top,
type: PropTypes.Number,
};

propsToUse.right = {
...propsToUse.right,
type: PropTypes.Number,
value: '0',
};

propsToUse.bottom = {
...propsToUse.bottom,
type: PropTypes.Number,
value: '0',
};

propsToUse.left = {
...propsToUse.left,
type: PropTypes.Number,
value: '0',
};

return {
config: {
componentName: 'EuiBottomBar',
props: propsToUse,
scope: {
EuiBottomBar,
EuiButton,
},
imports: {
'@elastic/eui': {
named: ['EuiBottomBar', 'EuiButton'],
},
},
},
};
};
Loading