Skip to content

Commit

Permalink
[UX] Restyle global breadcrumbs (#1954)
Browse files Browse the repository at this point in the history
* Issue-1858 Restyle global breadcrumbs

Signed-off-by: kaddy645 <xdeskart@amazon.com>

* Undo max count

Signed-off-by: kaddy645 <xdeskart@amazon.com>

* update snapshot

Signed-off-by: kaddy645 <xdeskart@amazon.com>

* add svg round-filter

Signed-off-by: kaddy645 <xdeskart@amazon.com>

* update tests

Signed-off-by: kaddy645 <xdeskart@amazon.com>

* spelling err

Signed-off-by: kaddy645 <xdeskart@amazon.com>

* remove un-necessary width

Signed-off-by: kaddy645 <xdeskart@amazon.com>

* pr updates

Signed-off-by: kaddy645 <xdeskart@amazon.com>

* pr updates

Signed-off-by: kaddy645 <xdeskart@amazon.com>

* clean code

Signed-off-by: kaddy645 <xdeskart@amazon.com>
  • Loading branch information
kaddy645 authored and noCharger committed Aug 3, 2022
1 parent f38b65e commit 8c6881f
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 10 deletions.
3 changes: 3 additions & 0 deletions src/core/public/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@import "@elastic/eui/src/global_styling/variables/header";

$osdHeaderOffset: $euiHeaderHeightCompensation;
$osdHeaderBreadcrumbBlueBackground: #b9d9eb;
$osdHeaderBreadcrumbGrayBackground: #d9e1e2;
$osdHeaderBreadcrumbCollapsedLink: #002a3a;
8 changes: 8 additions & 0 deletions src/core/public/chrome/public/assets/round_filter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions src/core/public/chrome/ui/header/header_breadcrumbs.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
@import "../../../../public/variables";

$firstBreadcrumbPolygon: polygon(
0% 0%,
100% 0%,
calc(100% - #{$euiSizeS}) 100%,
0% 100%
);
$breadcrumbPolygon: polygon(
$euiSizeS 0%,
100% 0%,
calc(100% - #{$euiSizeS}) 100%,
0% 100%
);

.osdHeaderBreadcrumbs {
/*
filter defines a custom filter effect by grouping atomic filter primitives!
here we are using Gaussian filter with stdDeviation for applying
border-radius on clipped background.
*/

filter: url("../../public/assets/round_filter.svg#round");

.osdBreadcrumbs {
clip-path: $breadcrumbPolygon;
background-color: $osdHeaderBreadcrumbGrayBackground;
padding: $euiSizeXS - 2.5 $euiSizeL - $euiSizeXS;

&:first-child {
clip-path: $firstBreadcrumbPolygon;
}

&:last-child {
background-color: $osdHeaderBreadcrumbBlueBackground;
}
}

.euiBreadcrumbSeparator {
display: none;
}

.euiBreadcrumb__collapsedLink {
color: $osdHeaderBreadcrumbCollapsedLink;
background: $euiColorEmptyShade;
}

.euiPopover__anchor {
padding: 0 $euiSizeS;
}

.euiBreadcrumb:not(.euiBreadcrumb:last-child) {
margin-right: 0;
}
}
12 changes: 11 additions & 1 deletion src/core/public/chrome/ui/header/header_breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import useObservable from 'react-use/lib/useObservable';
import { Observable } from 'rxjs';
import { ChromeBreadcrumb } from '../../chrome_service';

import './header_breadcrumbs.scss';

interface Props {
appTitle$: Observable<string>;
breadcrumbs$: Observable<ChromeBreadcrumb[]>;
Expand All @@ -57,7 +59,15 @@ export function HeaderBreadcrumbs({ appTitle$, breadcrumbs$ }: Props) {
i === 0 && 'first',
i === breadcrumbs.length - 1 && 'last'
),
className: classNames('osdBreadcrumbs'),
}));

return <EuiHeaderBreadcrumbs breadcrumbs={crumbs} max={10} data-test-subj="breadcrumbs" />;
return (
<EuiHeaderBreadcrumbs
breadcrumbs={crumbs}
max={10}
data-test-subj="breadcrumbs"
className="osdHeaderBreadcrumbs"
/>
);
}

0 comments on commit 8c6881f

Please sign in to comment.