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

Show all breadcrumbs in a popover #2342

Merged
merged 26 commits into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8c1a8a4
Conditionally changing the ellipsis to a button.
daveyholler Sep 7, 2019
f779adc
Adding hook for popover state.
daveyholler Sep 12, 2019
3e6f777
Merge remote-tracking branch 'upstream/master' into responsive-breadc…
daveyholler Sep 12, 2019
3a9b16c
Showing breadcrumbs in a popover
daveyholler Sep 13, 2019
5ae1183
Adding an aria-label
daveyholler Sep 13, 2019
173dee8
Changelog entry
daveyholler Sep 13, 2019
7d24b61
Merge branch 'master' into responsive-breadcrumbs
daveyholler Sep 13, 2019
1288e1e
Updating doc example text.
daveyholler Sep 13, 2019
cba39e1
Merge branch 'responsive-breadcrumbs' of github.com:daveyholler/eui i…
daveyholler Sep 13, 2019
9d7355e
Using a badge style for the clickable ellipsis
daveyholler Sep 17, 2019
5adf6d4
Merge branch 'master' into responsive-breadcrumbs
daveyholler Sep 17, 2019
19a5f5e
Merge branch 'master' into responsive-breadcrumbs
daveyholler Sep 18, 2019
2ff3997
PR review changes
daveyholler Sep 18, 2019
55f3831
Removing an unused selector
daveyholler Sep 18, 2019
f95bebd
Merge branch 'master' into responsive-breadcrumbs
daveyholler Sep 18, 2019
7a2eb67
Update src/components/breadcrumbs/breadcrumbs.js
daveyholler Sep 18, 2019
9347c11
Removing unnecessary ID
daveyholler Sep 18, 2019
ae3ccaa
Only displaying the hidden items in the popover
daveyholler Sep 19, 2019
2d9413c
Updating tests, removing rogue comment
daveyholler Sep 19, 2019
fb4cebe
Merge branch 'master' into responsive-breadcrumbs
daveyholler Sep 19, 2019
2cf56b4
Copy changes
daveyholler Sep 19, 2019
eae3d39
Merge branch 'responsive-breadcrumbs' of github.com:daveyholler/eui i…
daveyholler Sep 19, 2019
88a8e95
Update src/components/breadcrumbs/breadcrumbs.js
daveyholler Sep 19, 2019
f0247a5
Updating a class name.
daveyholler Sep 19, 2019
49d3aa6
Refining the method of displaying hidden breadcrumbs.
daveyholler Sep 23, 2019
14f1d37
Merge branch 'master' into responsive-breadcrumbs
daveyholler Sep 24, 2019
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Added a `showMaxPopover` option for `EuiBreadcrumbs` to display all items when a `max` is set. ([#2342](https://github.com/elastic/eui/pull/2342))

**Bug fixes**

- Fixed spacing of `EuiFormErrorText` to match `EuiFormHelpText` ([#2354](https://github.com/elastic/eui/pull/2354))
Expand Down
34 changes: 34 additions & 0 deletions src-docs/src/views/breadcrumbs/breadcrumbs_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ const maxSnippet = `<EuiBreadcrumbs
/>
`;

import Popover from './popover';
const popoverSource = require('!!raw-loader!./popover');
const popoverHtml = renderToHtml(Popover);
const popoverSnippet = `<EuiBreadcrumbs
breadcrumbs={breadcrumbs}
showPopover
/>
`;

export const BreadcrumbsExample = {
title: 'Breadcrumbs',
sections: [
Expand Down Expand Up @@ -152,5 +161,30 @@ export const BreadcrumbsExample = {
snippet: maxSnippet,
demo: <Max />,
},
{
title: 'Show the hidden items in a popover',
source: [
{
type: GuideSectionTypes.JS,
code: popoverSource,
},
{
type: GuideSectionTypes.HTML,
code: popoverHtml,
},
],
text: (
<p>
When the breadcrumbs need to be truncated, but you wish to still allow
users to navigate to any item in the list, you can use the{' '}
<EuiCode>showMaxPopover</EuiCode> prop. When used with the{' '}
<EuiCode>max</EuiCode> prop, the hidden breadcrumbs will be rendered
into an <EuiCode>EuiPopover</EuiCode>.
</p>
),
props: { EuiBreadcrumbs },
snippet: popoverSnippet,
demo: <Popover />,
},
],
};
135 changes: 135 additions & 0 deletions src-docs/src/views/breadcrumbs/popover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
import React, { Fragment } from 'react';

import { EuiBreadcrumbs } from '../../../../src/components';

export default () => {
const breadcrumbs = [
{
text: 'root',
href: '#',
onClick: e => {
e.preventDefault();
console.log('You clicked root');
},
'data-test-subj': 'breadcrumbsroot',
},
{
text: 'item 2',
href: '#',
onClick: e => {
e.preventDefault();
console.log('You clicked src');
},
},
{
text: 'item 3',
href: '#',
onClick: e => {
e.preventDefault();
console.log('You clicked item 3');
},
},
{
text: 'item 4',
href: '#',
onClick: e => {
e.preventDefault();
console.log('You clicked item 4');
},
},
{
text: 'item 5',
href: '#',
onClick: e => {
e.preventDefault();
console.log('You clicked item 5');
},
},
{
text: 'item 6',
href: '#',
onClick: e => {
e.preventDefault();
console.log('You clicked item 6');
},
},
{
text: 'item 7',
href: '#',
onClick: e => {
e.preventDefault();
console.log('You clicked item 7');
},
},
{
text: 'item 8',
href: '#',
onClick: e => {
e.preventDefault();
console.log('You clicked item 8');
},
},
{
text: 'item 9',
href: '#',
onClick: e => {
e.preventDefault();
console.log('You clicked item 9');
},
},
{
text: 'item 10',
href: '#',
onClick: e => {
e.preventDefault();
console.log('You clicked item 10');
},
},
{
text: 'item 11',
href: '#',
onClick: e => {
e.preventDefault();
console.log('You clicked item 11');
},
},
{
text: 'item 12',
href: '#',
onClick: e => {
e.preventDefault();
console.log('You clicked item 12');
},
},
{
text: 'item 13',
href: '#',
onClick: e => {
e.preventDefault();
console.log('You clicked item 13');
},
},
{
text: 'item 14',
href: '#',
onClick: e => {
e.preventDefault();
console.log('You clicked item 14');
},
},
{
text: 'button_empty.tsx',
},
];

return (
<Fragment>
<EuiBreadcrumbs
breadcrumbs={breadcrumbs}
truncate={false}
max={5}
showMaxPopover
/>
</Fragment>
);
};
51 changes: 51 additions & 0 deletions src/components/breadcrumbs/__snapshots__/breadcrumbs.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,57 @@ exports[`EuiBreadcrumbs props max renders 3 items 1`] = `
</nav>
`;

exports[`EuiBreadcrumbs props render a popover is rendered 1`] = `
<nav
aria-label="breadcrumb"
class="euiBreadcrumbs euiBreadcrumbs--truncate euiBreadcrumbs--responsive"
>
<button
class="euiLink euiLink--subdued euiBreadcrumb"
title="Animals"
type="button"
>
Animals
</button>
<div
class="euiBreadcrumbSeparator"
/>
<div
class="euiPopover euiPopover--anchorDownCenter"
>
<div
class="euiPopover__anchor"
>
<button
aria-label="Show all breadcrumbs"
class="euiBadge euiBadge-isClickable euiBadge--iconLeft euiBadge--default euiBreadcrumb euiBreadcrumb__collapsedBadge"
title="View hidden breadcrumbs"
>
<span
class="euiBadge__content"
>
<span
class="euiBadge__text"
>
</span>
</span>
</button>
</div>
</div>
<div
class="euiBreadcrumbSeparator"
/>
<span
aria-current="page"
class="euiBreadcrumb euiBreadcrumb--last"
title="Edit"
>
Edit
</span>
</nav>
`;

exports[`EuiBreadcrumbs props responsive is rendered 1`] = `
<nav
aria-label="breadcrumb"
Expand Down
21 changes: 21 additions & 0 deletions src/components/breadcrumbs/_breadcrumbs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@
background: $euiColorLightShade;
}

.euiBreadcrumbs__inPopover {
.euiBreadcrumb--last.euiLink.euiLink--text {
font-weight: $euiFontWeightRegular;
color: $euiColorDarkShade;
}
}

.euiBreadcrumb__collapsedBadge {
height: $euiSize;
margin-top: -$euiSizeM / 2;
background-color: transparentize($euiColorDarkestShade, .85);

.euiBadge__content {
margin-top: -$euiSizeXS / 2;
}
}

/**
* 1. Can't target separator vs breadcrumb with -of-type because it takes
* the dom element into consideration too and there could be divs, or spans, or a's
Expand Down Expand Up @@ -96,6 +113,10 @@
// Align with flex versus inline-block misaligns the separator slightly
transform: translateY(0) rotate(15deg);
}

.euiBreadcrumbBadge {
margin-top: -$euiSizeXS / 2;
}
}

.euiBreadcrumb--truncate {
Expand Down
Loading