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

[backport] PR #8196 to 5.x - Add globalNav styles that prevent the nav items from overlapping when the window is very short. #8203

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
72 changes: 40 additions & 32 deletions src/ui/public/chrome/directives/global_nav/global_nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,52 @@
ng-class="{'is-global-nav-open': isGlobalNavOpen}"
ng-show="isVisible"
>

<!-- Logo -->
<li
ng-if="!logoBrand && !smallLogoBrand"
aria-label="{{ appTitle }} Logo"
class="logo kibana"
></li>
<div class="global-nav__logo">
<li
ng-if="!logoBrand && !smallLogoBrand"
aria-label="{{ appTitle }} Logo"
class="logo kibana"
></li>

<li
ng-if="logoBrand"
ng-style="{ 'background': logoBrand }"
aria-label="{{ appTitle }} Logo"
class="logo hidden-sm"
></li>
<li
ng-if="logoBrand"
ng-style="{ 'background': logoBrand }"
aria-label="{{ appTitle }} Logo"
class="logo hidden-sm"
></li>

<li
ng-if="smallLogoBrand"
ng-style="{ 'background': smallLogoBrand }"
aria-label="{{ appTitle }} Logo"
class="logo-small visible-sm hidden-xs"
></li>
<li
ng-if="smallLogoBrand"
ng-style="{ 'background': smallLogoBrand }"
aria-label="{{ appTitle }} Logo"
class="logo-small visible-sm hidden-xs"
></li>
</div>

<!-- Main apps -->
<app-switcher
chrome="chrome"
></app-switcher>
<!-- Links -->
<div class="global-nav__links">
<!-- Main apps -->
<div class="global-nav__links-section">
<app-switcher
chrome="chrome"
></app-switcher>
</div>

<!-- Bottom button -->
<div class="gloal-nav__bottom-links">
<div class="chrome-actions" kbn-chrome-append-nav-controls></div>
<!-- Bottom button -->
<div class="global-nav__links-section">
<div class="chrome-actions" kbn-chrome-append-nav-controls></div>

<!-- Open/close sidebar -->
<global-nav-link
class="{{ globalNavToggleButton.classes }}"
tooltip-content="globalNavToggleButton.tooltipContent"
on-click="toggleGlobalNav($event)"
icon="'plugins/kibana/assets/play-circle.svg'"
title="globalNavToggleButton.title"
></global-nav-link>
<!-- Open/close sidebar -->
<global-nav-link
class="{{ globalNavToggleButton.classes }}"
tooltip-content="globalNavToggleButton.tooltipContent"
on-click="toggleGlobalNav($event)"
icon="'plugins/kibana/assets/play-circle.svg'"
title="globalNavToggleButton.title"
></global-nav-link>
</div>
</div>

</nav>
44 changes: 40 additions & 4 deletions src/ui/public/chrome/directives/global_nav/global_nav.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

@import (reference) "~ui/styles/mixins";
@import (reference) "~ui/styles/variables";

@global-nav-logo-height: 70px;

.global-nav {
width: @as-closed-width;
position: fixed;
Expand All @@ -25,7 +28,7 @@

.logo-small,
.logo {
height: 70px;
height: @global-nav-logo-height;
width: @as-open-width;
list-style-type: none;
&.kibana {
Expand All @@ -38,7 +41,40 @@
}
}

.gloal-nav__bottom-links {
position: absolute;
bottom: 0;
/**
* 1. Push main apps to the top and bottom buttons to the bottom.
* 2. Fill height of global nav, but respect the height of the logo.
* 3. Allow user to scroll to see clipped nav items when the nav is too short.
* 4. Style the scrollbar to look good in Chrome and Safari.
*/
.global-nav__links {
display: flex; /* 1 */
flex-direction: column; /* 1 */
justify-content: space-between; /* 1 */
height: ~"calc(100% - @{global-nav-logo-height})"; /* 2 */
overflow-x: hidden; /* 3 */
overflow-y: auto; /* 3 */

&::-webkit-scrollbar { /* 4 */
width: 16px;
height: 16px;
}

&::-webkit-scrollbar-thumb { /* 4 */
background-color: #2f99c1;
border: 6px solid transparent;
background-clip: content-box;
}

&::-webkit-scrollbar-track { /* 4 */
background-color: transparent;
}
}

/**
* 1. Prevent the top and bottom links from collapsing when the browser window is too short.
* This problem is specific to Safari.
*/
.global-nav__links-section {
flex: 0 0 auto; /* 1 */
}