diff --git a/src/ui/public/_index.scss b/src/ui/public/_index.scss index 771f4b85e2b2..234eaa53e96f 100644 --- a/src/ui/public/_index.scss +++ b/src/ui/public/_index.scss @@ -11,6 +11,13 @@ @import './doc_viewer/index'; @import './inspector/index'; @import './markdown/index'; +@import './accessibility/index'; +@import './chrome/index'; +@import './error_allow_explicit_index/index'; +@import './error_auto_create_index/index'; +@import './error_url_overflow/index'; +@import './field_editor/index'; +@import './notify/index'; @import './query_bar/index'; // The following are prefixed with "vis" diff --git a/src/ui/public/accessibility/__tests__/kbn_ui_ace_keyboard_mode.js b/src/ui/public/accessibility/__tests__/kbn_ui_ace_keyboard_mode.js index 2444fd76c6e8..784528447995 100644 --- a/src/ui/public/accessibility/__tests__/kbn_ui_ace_keyboard_mode.js +++ b/src/ui/public/accessibility/__tests__/kbn_ui_ace_keyboard_mode.js @@ -29,17 +29,19 @@ describe('kbnUiAceKeyboardMode directive', () => { beforeEach(ngMock.module('kibana')); - beforeEach(ngMock.inject(($compile, $rootScope) => { - element = $compile(`
`)($rootScope.$new()); - })); + beforeEach( + ngMock.inject(($compile, $rootScope) => { + element = $compile(`
`)($rootScope.$new()); + }) + ); it('should add the hint element', () => { - expect(element.find('.uiAceKeyboardHint').length).to.be(1); + expect(element.find('.kbnUiAceKeyboardHint').length).to.be(1); }); describe('hint element', () => { it('should be tabable', () => { - expect(element.find('.uiAceKeyboardHint').attr('tabindex')).to.be('0'); + expect(element.find('.kbnUiAceKeyboardHint').attr('tabindex')).to.be('0'); }); it('should move focus to textbox and be inactive if pressed enter on it', () => { @@ -47,20 +49,22 @@ describe('kbnUiAceKeyboardMode directive', () => { sinon.spy(textarea[0], 'focus'); const ev = angular.element.Event('keydown'); // eslint-disable-line new-cap ev.keyCode = keyCodes.ENTER; - element.find('.uiAceKeyboardHint').trigger(ev); + element.find('.kbnUiAceKeyboardHint').trigger(ev); expect(textarea[0].focus.called).to.be(true); - expect(element.find('.uiAceKeyboardHint').hasClass('uiAceKeyboardHint-isInactive')).to.be(true); + expect( + element.find('.kbnUiAceKeyboardHint').hasClass('kbnUiAceKeyboardHint-isInactive') + ).to.be(true); }); it('should be shown again, when pressing Escape in ace editor', () => { const textarea = element.find('textarea'); - const hint = element.find('.uiAceKeyboardHint'); + const hint = element.find('.kbnUiAceKeyboardHint'); sinon.spy(hint[0], 'focus'); const ev = angular.element.Event('keydown'); // eslint-disable-line new-cap ev.keyCode = keyCodes.ESCAPE; textarea.trigger(ev); expect(hint[0].focus.called).to.be(true); - expect(hint.hasClass('uiAceKeyboardHint-isInactive')).to.be(false); + expect(hint.hasClass('kbnUiAceKeyboardHint-isInactive')).to.be(false); }); }); @@ -69,7 +73,6 @@ describe('kbnUiAceKeyboardMode directive', () => { expect(element.find('textarea').attr('tabindex')).to.be('-1'); }); }); - }); describe('kbnUiAceKeyboardModeService', () => { @@ -77,19 +80,21 @@ describe('kbnUiAceKeyboardModeService', () => { beforeEach(ngMock.module('kibana')); - beforeEach(ngMock.inject(($compile, $rootScope, kbnUiAceKeyboardModeService) => { - const scope = $rootScope.$new(); - element = $compile(`
`)(scope); - kbnUiAceKeyboardModeService.initialize(scope, element); - })); + beforeEach( + ngMock.inject(($compile, $rootScope, kbnUiAceKeyboardModeService) => { + const scope = $rootScope.$new(); + element = $compile(`
`)(scope); + kbnUiAceKeyboardModeService.initialize(scope, element); + }) + ); it('should add the hint element', () => { - expect(element.find('.uiAceKeyboardHint').length).to.be(1); + expect(element.find('.kbnUiAceKeyboardHint').length).to.be(1); }); describe('hint element', () => { it('should be tabable', () => { - expect(element.find('.uiAceKeyboardHint').attr('tabindex')).to.be('0'); + expect(element.find('.kbnUiAceKeyboardHint').attr('tabindex')).to.be('0'); }); it('should move focus to textbox and be inactive if pressed enter on it', () => { @@ -97,20 +102,22 @@ describe('kbnUiAceKeyboardModeService', () => { sinon.spy(textarea[0], 'focus'); const ev = angular.element.Event('keydown'); // eslint-disable-line new-cap ev.keyCode = keyCodes.ENTER; - element.find('.uiAceKeyboardHint').trigger(ev); + element.find('.kbnUiAceKeyboardHint').trigger(ev); expect(textarea[0].focus.called).to.be(true); - expect(element.find('.uiAceKeyboardHint').hasClass('uiAceKeyboardHint-isInactive')).to.be(true); + expect( + element.find('.kbnUiAceKeyboardHint').hasClass('kbnUiAceKeyboardHint-isInactive') + ).to.be(true); }); it('should be shown again, when pressing Escape in ace editor', () => { const textarea = element.find('textarea'); - const hint = element.find('.uiAceKeyboardHint'); + const hint = element.find('.kbnUiAceKeyboardHint'); sinon.spy(hint[0], 'focus'); const ev = angular.element.Event('keydown'); // eslint-disable-line new-cap ev.keyCode = keyCodes.ESCAPE; textarea.trigger(ev); expect(hint[0].focus.called).to.be(true); - expect(hint.hasClass('uiAceKeyboardHint-isInactive')).to.be(false); + expect(hint.hasClass('kbnUiAceKeyboardHint-isInactive')).to.be(false); }); }); @@ -119,5 +126,4 @@ describe('kbnUiAceKeyboardModeService', () => { expect(element.find('textarea').attr('tabindex')).to.be('-1'); }); }); - }); diff --git a/src/ui/public/accessibility/_index.scss b/src/ui/public/accessibility/_index.scss new file mode 100644 index 000000000000..95062449e4b1 --- /dev/null +++ b/src/ui/public/accessibility/_index.scss @@ -0,0 +1 @@ +@import './kbn_ui_ace_keyboard_mode'; diff --git a/src/ui/public/accessibility/kbn_ui_ace_keyboard_mode.less b/src/ui/public/accessibility/_kbn_ui_ace_keyboard_mode.scss similarity index 60% rename from src/ui/public/accessibility/kbn_ui_ace_keyboard_mode.less rename to src/ui/public/accessibility/_kbn_ui_ace_keyboard_mode.scss index cb879b18af77..9ace600db419 100644 --- a/src/ui/public/accessibility/kbn_ui_ace_keyboard_mode.less +++ b/src/ui/public/accessibility/_kbn_ui_ace_keyboard_mode.scss @@ -1,12 +1,10 @@ -@import (reference) "~ui/styles/variables"; - -.uiAceKeyboardHint { +.kbnUiAceKeyboardHint { position: absolute; top: 0; bottom: 0; right: 0; left: 0; - background: rgba(255, 255, 255, 0.7); + background: transparentize($euiColorEmptyShade, 0.3); display: flex; flex-direction: column; justify-content: center; @@ -16,11 +14,11 @@ &:focus { opacity: 1; - border: 2px solid @globalColorBlue; + border: 2px solid $euiColorPrimary; z-index: 1000; } - &.uiAceKeyboardHint-isInactive { + &.kbnUiAceKeyboardHint-isInactive { display: none; } } diff --git a/src/ui/public/accessibility/kbn_ui_ace_keyboard_mode.js b/src/ui/public/accessibility/kbn_ui_ace_keyboard_mode.js index 5e4fa35e4efc..b18464b9ab90 100644 --- a/src/ui/public/accessibility/kbn_ui_ace_keyboard_mode.js +++ b/src/ui/public/accessibility/kbn_ui_ace_keyboard_mode.js @@ -33,19 +33,19 @@ import angular from 'angular'; import { uiModules } from '../modules'; -import './kbn_ui_ace_keyboard_mode.less'; import { keyCodes } from '@elastic/eui'; let aceKeyboardModeId = 0; -uiModules.get('kibana') +uiModules + .get('kibana') .factory('kbnUiAceKeyboardModeService', () => ({ initialize(scope, element) { - const uniqueId = `uiAceKeyboardHint-${scope.$id}-${aceKeyboardModeId++}`; + const uniqueId = `kbnUiAceKeyboardHint-${scope.$id}-${aceKeyboardModeId++}`; const hint = angular.element( `
{ + hint.keydown(ev => { if (ev.keyCode === keyCodes.ENTER) { ev.preventDefault(); startEditing(); @@ -86,19 +86,23 @@ uiModules.get('kibana') // We have to capture this event on the 'capture' phase, otherwise Ace will have already // dismissed the autocompleter when the user hits ESC. - document.addEventListener('keydown', () => { - const autoCompleter = document.querySelector('.ace_autocomplete'); + document.addEventListener( + 'keydown', + () => { + const autoCompleter = document.querySelector('.ace_autocomplete'); - if (!autoCompleter) { - isAutoCompleterOpen = false; - return; - } + if (!autoCompleter) { + isAutoCompleterOpen = false; + return; + } - // The autoComplete is just hidden when it's closed, not removed from the DOM. - isAutoCompleterOpen = autoCompleter.style.display !== 'none'; - }, { capture: true }); + // The autoComplete is just hidden when it's closed, not removed from the DOM. + isAutoCompleterOpen = autoCompleter.style.display !== 'none'; + }, + { capture: true } + ); - uiAceTextbox.keydown((ev) => { + uiAceTextbox.keydown(ev => { if (ev.keyCode === keyCodes.ESCAPE) { // If the autocompletion context menu is open then we want to let ESC close it but // **not** exit out of editing mode. @@ -115,11 +119,11 @@ uiModules.get('kibana') // Prevent tabbing into the ACE textarea, we now handle all focusing for it uiAceTextbox.attr('tabindex', '-1'); element.prepend(hint); - } + }, })) - .directive('kbnUiAceKeyboardMode', (kbnUiAceKeyboardModeService) => ({ + .directive('kbnUiAceKeyboardMode', kbnUiAceKeyboardModeService => ({ restrict: 'A', link(scope, element) { kbnUiAceKeyboardModeService.initialize(scope, element); - } + }, })); diff --git a/src/ui/public/chrome/_index.scss b/src/ui/public/chrome/_index.scss new file mode 100644 index 000000000000..7e6c3ebaccc5 --- /dev/null +++ b/src/ui/public/chrome/_index.scss @@ -0,0 +1,3 @@ +@import './variables'; + +@import './directives/index'; diff --git a/src/ui/public/chrome/_variables.scss b/src/ui/public/chrome/_variables.scss new file mode 100644 index 000000000000..902847c446aa --- /dev/null +++ b/src/ui/public/chrome/_variables.scss @@ -0,0 +1,11 @@ + +$kbnChromeGlobalNavBackground: shade($euiColorPrimary, 30%); + +$kbnGlobalNavClosedWidth: 53px; +$kbnGlobalNavOpenWidth: 180px; +$kbnGlobalNavLogoHeight: 70px; +$kbnGlobalNavAppIconHeight: 38px; + +$kbnLoadingIndicatorBackgroundSize: $euiSizeXXL * 10; +$kbnLoadingIndicatorColor1: tint($euiColorAccent, 15%); +$kbnLoadingIndicatorColor2: tint($euiColorAccent, 60%); diff --git a/src/ui/public/chrome/directives/__snapshots__/loading_indicator.test.js.snap b/src/ui/public/chrome/directives/__snapshots__/loading_indicator.test.js.snap index b9d9391a05d8..3007be1e5dfe 100644 --- a/src/ui/public/chrome/directives/__snapshots__/loading_indicator.test.js.snap +++ b/src/ui/public/chrome/directives/__snapshots__/loading_indicator.test.js.snap @@ -2,22 +2,22 @@ exports[`kbnLoadingIndicator is hidden by default 1`] = `
`; exports[`kbnLoadingIndicator is visible when loadingCount is > 0 1`] = `
`; diff --git a/src/ui/public/chrome/directives/_index.scss b/src/ui/public/chrome/directives/_index.scss new file mode 100644 index 000000000000..6f63cf424b24 --- /dev/null +++ b/src/ui/public/chrome/directives/_index.scss @@ -0,0 +1,5 @@ +@import './kbn_chrome'; +@import './loading_indicator'; + +@import './global_nav/index'; +@import './header_global_nav/index'; diff --git a/src/ui/public/chrome/directives/kbn_chrome.less b/src/ui/public/chrome/directives/_kbn_chrome.scss similarity index 75% rename from src/ui/public/chrome/directives/kbn_chrome.less rename to src/ui/public/chrome/directives/_kbn_chrome.scss index a87f906286e1..052cabec1be4 100644 --- a/src/ui/public/chrome/directives/kbn_chrome.less +++ b/src/ui/public/chrome/directives/_kbn_chrome.scss @@ -1,12 +1,9 @@ - -@import (reference) "~ui/styles/mixins"; -@import (reference) "~ui/styles/variables"; - /** * stretch the root element of the Kibana application to set the base-size that * flexed children should keep. Only works when paired with root styles applied * by core service from new platform */ +// SASSTODO: Naming here is too embedded and high up that changing them could cause major breaks #kibana-body { overflow-x: hidden; min-height: 100%; @@ -16,16 +13,16 @@ display: flex; flex-flow: column nowrap; position: absolute; - left: @global-nav-closed-width; + left: $kbnGlobalNavClosedWidth; top: 0; right: 0; bottom: 0; z-index: 5; margin: 0 auto; - background-color: #fff; + background-color: $euiColorEmptyShade; /** - * 1. Dirty, but we need to override the .is-global-nav-open state + * 1. Dirty, but we need to override the .kbnGlobalNav-isOpen state * when we're looking at the log-in screen. */ &.hidden-chrome { diff --git a/src/ui/public/chrome/directives/_loading_indicator.scss b/src/ui/public/chrome/directives/_loading_indicator.scss new file mode 100644 index 000000000000..cca5af5d80a2 --- /dev/null +++ b/src/ui/public/chrome/directives/_loading_indicator.scss @@ -0,0 +1,46 @@ +/** + * 1. Position this loader on top of the content. + * 2. Make sure indicator isn't wider than the screen. + */ +.kbnLoadingIndicator { + position: fixed; // 1 + top: 0; // 1 + left: 0; // 1 + right: 0; // 1 + z-index: $euiZLevel1; // 1 + overflow: hidden; // 2 + height: $euiSizeXS / 2; + + &.hidden { + visibility: hidden; + opacity: 0; + transition-delay: 0.25s; + } +} + + .kbnLoadingIndicator__bar { + top: 0; + left: 0; + right: 0; + bottom: 0; + position: absolute; + z-index: $euiZLevel1 + 1; + visibility: visible; + display: block; + animation: kbn-animate-loading-indicator 2s linear infinite; + background-color: $kbnLoadingIndicatorColor2; + background-image: linear-gradient(to right, + $kbnLoadingIndicatorColor1 0%, + $kbnLoadingIndicatorColor1 50%, + $kbnLoadingIndicatorColor2 50%, + $kbnLoadingIndicatorColor2 100% + ); + background-repeat: repeat-x; + background-size: $kbnLoadingIndicatorBackgroundSize $kbnLoadingIndicatorBackgroundSize; + width: 200%; + } + + @keyframes kbn-animate-loading-indicator { + from { transform: translateX(0); } + to { transform: translateX(-$kbnLoadingIndicatorBackgroundSize); } + } diff --git a/src/ui/public/chrome/directives/global_nav/_global_nav.scss b/src/ui/public/chrome/directives/global_nav/_global_nav.scss new file mode 100644 index 000000000000..d1ea87e9a442 --- /dev/null +++ b/src/ui/public/chrome/directives/global_nav/_global_nav.scss @@ -0,0 +1,70 @@ +.kbnGlobalNav { + width: $kbnGlobalNavClosedWidth; + position: fixed; + left: 0; + top: 0; + bottom: 0; + z-index: 0; + background-color: $kbnChromeGlobalNavBackground; + overflow: hidden; + + &.kbnGlobalNav-isOpen { + width: $kbnGlobalNavOpenWidth; + + + .app-wrapper { + left: $kbnGlobalNavOpenWidth; + } + } + + .kbnGlobalNav__smallLogoBrand, + .kbnGlobalNav__logoBrand { + height: $kbnGlobalNavLogoHeight; + width: $kbnGlobalNavOpenWidth; + list-style-type: none; + } +} + +/** + * 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. + */ +.kbnGlobalNav__links { + @include euiScrollBar; /* 4 */ + + display: flex; /* 1 */ + flex-direction: column; /* 1 */ + justify-content: space-between; /* 1 */ + height: calc(100% - #{$kbnGlobalNavLogoHeight}); /* 2 */ + overflow-x: hidden; /* 3 */ + overflow-y: auto; /* 3 */ + + &::-webkit-scrollbar { /* 4 */ + @include size($euiSizeS); + } + + &::-webkit-scrollbar-thumb { /* 4 */ + background-color: tint($kbnChromeGlobalNavBackground, 50%); + } +} + +/** + * 1. Prevent the top and bottom links from collapsing when the browser window is too short. + * This problem is specific to Safari. + */ +.kbnGlobalNav__linksSection { + flex: 0 0 auto; /* 1 */ +} + +.kbnGlobalNav__logoLink { + display: inline-block; + + &:hover { + background-color: darken($euiColorPrimary, 15%); + } + + &.active { + background-color: $euiColorPrimary; + } +} diff --git a/src/ui/public/chrome/directives/global_nav/_index.scss b/src/ui/public/chrome/directives/global_nav/_index.scss new file mode 100644 index 000000000000..6113fe352641 --- /dev/null +++ b/src/ui/public/chrome/directives/global_nav/_index.scss @@ -0,0 +1,2 @@ +@import './global_nav'; +@import './global_nav_link/index'; diff --git a/src/ui/public/chrome/directives/global_nav/global_nav.html b/src/ui/public/chrome/directives/global_nav/global_nav.html index 3bb669c59a6c..a2deb53cdb6e 100644 --- a/src/ui/public/chrome/directives/global_nav/global_nav.html +++ b/src/ui/public/chrome/directives/global_nav/global_nav.html @@ -1,14 +1,13 @@ diff --git a/src/ui/public/chrome/directives/global_nav/global_nav.js b/src/ui/public/chrome/directives/global_nav/global_nav.js index 5a87fd787817..cedb56c11844 100644 --- a/src/ui/public/chrome/directives/global_nav/global_nav.js +++ b/src/ui/public/chrome/directives/global_nav/global_nav.js @@ -17,7 +17,6 @@ * under the License. */ - import './app_switcher'; import './global_nav_link'; import 'ui/i18n'; @@ -46,13 +45,21 @@ module.directive('globalNav', (globalNavState, chrome, i18n) => { const isOpen = globalNavState.isOpen(); scope.isGlobalNavOpen = isOpen; scope.globalNavToggleButton = { - classes: isOpen ? 'global-nav-link--close' : undefined, - title: isOpen ? - i18n('common.ui.chrome.globalNav.navToggleButtonCollapseTitle', { defaultMessage: 'Collapse' }) - : i18n('common.ui.chrome.globalNav.navToggleButtonExpandTitle', { defaultMessage: 'Expand' }), - tooltipContent: isOpen ? - i18n('common.ui.chrome.globalNav.navToggleButtonCollapseTooltip', { defaultMessage: 'Collapse side bar' }) - : i18n('common.ui.chrome.globalNav.navToggleButtonExpandTooltip', { defaultMessage: 'Expand side bar' }), + classes: isOpen ? 'kbnGlobalNavLink--close' : undefined, + title: isOpen + ? i18n('common.ui.chrome.globalNav.navToggleButtonCollapseTitle', { + defaultMessage: 'Collapse', + }) + : i18n('common.ui.chrome.globalNav.navToggleButtonExpandTitle', { + defaultMessage: 'Expand', + }), + tooltipContent: isOpen + ? i18n('common.ui.chrome.globalNav.navToggleButtonCollapseTooltip', { + defaultMessage: 'Collapse side bar', + }) + : i18n('common.ui.chrome.globalNav.navToggleButtonExpandTooltip', { + defaultMessage: 'Expand side bar', + }), }; // Notify visualizations, e.g. the dashboard, that they should re-render. @@ -77,6 +84,6 @@ module.directive('globalNav', (globalNavState, chrome, i18n) => { scope.isHomeActive = () => { return window.location.hash.indexOf('#/home') === 0; }; - } + }, }; }); diff --git a/src/ui/public/chrome/directives/global_nav/global_nav.less b/src/ui/public/chrome/directives/global_nav/global_nav.less index a81360fcc0db..d679b401e209 100644 --- a/src/ui/public/chrome/directives/global_nav/global_nav.less +++ b/src/ui/public/chrome/directives/global_nav/global_nav.less @@ -1,36 +1,7 @@ - -@import (reference) "~ui/styles/mixins"; -@import (reference) "~ui/styles/variables"; - -@global-nav-logo-height: 70px; - -.global-nav { - width: @global-nav-closed-width; - position: fixed; - left: 0; - top: 0; - bottom: 0; - z-index: 0; - background-color: #005571; - overflow: hidden; - - &.is-global-nav-open { - width: @global-nav-open-width; - - .app-title { - display: inline-block; - } - - + .app-wrapper { - left: @global-nav-open-width; - } - } - - .logo-small, - .logo { - height: @global-nav-logo-height; - width: @global-nav-open-width; - list-style-type: none; +// SASSTODO: Move to sass when image paths work +.kbnGlobalNav { + .kbnGlobalNav__smallLogoBrand, + .kbnGlobalNav__logoBrand { &.kibana { background-image: url("~ui/images/kibana.svg"); background-position: 10px 14px; @@ -39,41 +10,3 @@ } } } - - /** - * 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 */ - } diff --git a/src/ui/public/chrome/directives/global_nav/global_nav_link/__tests__/global_nav_link.js b/src/ui/public/chrome/directives/global_nav/global_nav_link/__tests__/global_nav_link.js index d265df874216..574a1e9a5dac 100644 --- a/src/ui/public/chrome/directives/global_nav/global_nav_link/__tests__/global_nav_link.js +++ b/src/ui/public/chrome/directives/global_nav/global_nav_link/__tests__/global_nav_link.js @@ -60,7 +60,6 @@ describe('globalNavLink directive', () => { } describe('interface', () => { - describe('isActive attribute', () => { it(`doesn't apply the active class when false`, () => { const element = create({ @@ -78,18 +77,18 @@ describe('globalNavLink directive', () => { }); describe('isDisabled attribute', () => { - it(`doesn't apply the is-global-nav-link-disabled class when false`, () => { + it(`doesn't apply the kbnGlobalNavLink-isDisabled class when false`, () => { const element = create({ isDisabled: false, }); - expect(element.hasClass('is-global-nav-link-disabled')).to.be(false); + expect(element.hasClass('kbnGlobalNavLink-isDisabled')).to.be(false); }); - it('applies the is-global-nav-link-disabled class when true', () => { + it('applies the kbnGlobalNavLink-isDisabled class when true', () => { const element = create({ isDisabled: true, }); - expect(element.hasClass('is-global-nav-link-disabled')).to.be(true); + expect(element.hasClass('kbnGlobalNavLink-isDisabled')).to.be(true); }); }); diff --git a/src/ui/public/chrome/directives/global_nav/global_nav_link/_global_nav_link.scss b/src/ui/public/chrome/directives/global_nav/global_nav_link/_global_nav_link.scss new file mode 100644 index 000000000000..7b7b1f70b18d --- /dev/null +++ b/src/ui/public/chrome/directives/global_nav/global_nav_link/_global_nav_link.scss @@ -0,0 +1,97 @@ +.kbnGlobalNavLink { + &:hover { + background-color: shade($euiColorPrimary, 15%); + } + + &.active { + background-color: $euiColorPrimary; + } +} + +.kbnGlobalNavLink { + position: relative; + width: $kbnGlobalNavClosedWidth; + height: $kbnGlobalNavAppIconHeight; + line-height: $euiSizeL; + + &.kbnGlobalNavLink-isDisabled { + opacity: 0.5; + + .kbnGlobalNavLink__anchor { + cursor: default; + } + } + + &.active { + .kbnGlobalNavLink__anchor { + color: $euiColorEmptyShade; + text-decoration: none; + } + } +} + +.kbnGlobalNav-isOpen { + .kbnGlobalNavLink { + width: $kbnGlobalNavOpenWidth; + } +} + +.kbnGlobalNavLink__anchor { + display: block; + height: 100%; + color: $euiColorEmptyShade; + width: 100%; + line-height: inherit; +} + +.kbnGlobalNavLink__icon { + display: inline-block; + width: $kbnGlobalNavClosedWidth; + height: $kbnGlobalNavAppIconHeight; + float: left; + text-align: center; + font-size: 1.7em; +} + +/** + * This image is used to display the icon. + */ +.kbnGlobalNavLink__iconImage { + height: 18px; + margin-top: $euiSizeS; +} + +/** + * This placeholder text gets shown if there is no specified icon. + */ +.kbnGlobalNavLink__iconPlaceholder { + line-height: $kbnGlobalNavAppIconHeight; + background-position: center; + background-size: contain; + background-repeat: no-repeat; +} + +.kbnGlobalNavLink__title { + @include euiTextTruncate; + display: none; + width: $kbnGlobalNavOpenWidth - $kbnGlobalNavClosedWidth - 3px; + float: right; + font-size: 0.9em; + text-align: left; + padding-left: 3px; + padding-right: 3px; + line-height: $kbnGlobalNavAppIconHeight; + + .kbnGlobalNav-isOpen & { + display: inline-block; + } +} + +.kbnGlobalNavLink--close { + /** + * 1. Translation accounts for the icon image being slightly off-center. + */ + .kbnGlobalNavLink__icon { + transform: translateX(1px) scaleX(-1); /* 1 */ + } +} diff --git a/src/ui/public/chrome/directives/global_nav/global_nav_link/_index.scss b/src/ui/public/chrome/directives/global_nav/global_nav_link/_index.scss new file mode 100644 index 000000000000..caa3e567bd5f --- /dev/null +++ b/src/ui/public/chrome/directives/global_nav/global_nav_link/_index.scss @@ -0,0 +1 @@ +@import './global_nav_link'; diff --git a/src/ui/public/chrome/directives/global_nav/global_nav_link/global_nav_link.html b/src/ui/public/chrome/directives/global_nav/global_nav_link/global_nav_link.html index e23fb0ce15e2..838cd00d04d4 100644 --- a/src/ui/public/chrome/directives/global_nav/global_nav_link/global_nav_link.html +++ b/src/ui/public/chrome/directives/global_nav/global_nav_link/global_nav_link.html @@ -1,37 +1,35 @@