ui: Add new Help menu with links to docs, learn and GH (#7310)

This commit is contained in:
John Cowen 2020-02-18 16:44:15 +00:00 committed by John Cowen
parent f306c753e2
commit 8e5cb78c1c
9 changed files with 42 additions and 8 deletions

View File

@ -9,6 +9,9 @@ export default Component.extend(Slotted, {
expanded: false, expanded: false,
keyboardAccess: true, keyboardAccess: true,
onchange: function() {}, onchange: function() {},
// TODO: this needs to be made dynamic/auto detect
// for now use this to set left/right explicitly
position: '',
init: function() { init: function() {
this._super(...arguments); this._super(...arguments);
this.guid = this.dom.guid(this); this.guid = this.dom.guid(this);

View File

@ -15,6 +15,9 @@
/* or be hardcoded */ /* or be hardcoded */
/* min-height: 143px; */ /* min-height: 143px; */
} }
%menu-panel [role='menuitem']::after {
float: right;
}
%menu-panel-sub-panel { %menu-panel-sub-panel {
position: absolute; position: absolute;
top: 0; top: 0;
@ -28,6 +31,7 @@
} }
%menu-panel:not(.left) { %menu-panel:not(.left) {
right: 0px; right: 0px;
left: auto;
} }
%menu-panel.left { %menu-panel.left {
left: 0px; left: 0px;

View File

@ -18,6 +18,9 @@
%main-nav-horizontal > ul > li.is-active > label > * { %main-nav-horizontal > ul > li.is-active > label > * {
@extend %main-nav-horizontal-action-active; @extend %main-nav-horizontal-action-active;
} }
%main-nav-horizontal label + div {
@extend %main-nav-horizontal-drop-nav;
}
%main-nav-horizontal-drop-nav { %main-nav-horizontal-drop-nav {
@extend %menu-panel; @extend %menu-panel;
} }

View File

@ -32,7 +32,7 @@
color: inherit; color: inherit;
} }
%main-nav-horizontal-toggle, %main-nav-horizontal-toggle,
%main-nav-horizontal input { %main-nav-horizontal input[type='checkbox'] {
display: none; display: none;
} }
%main-nav-horizontal [type='checkbox'] + label > *::after { %main-nav-horizontal [type='checkbox'] + label > *::after {

View File

@ -3,6 +3,16 @@
html body > svg { html body > svg {
display: none; display: none;
} }
%main-nav-horizontal .docs-link a::after {
@extend %with-learn-icon, %as-pseudo;
}
%main-nav-horizontal .learn-link a::after {
@extend %with-docs-icon, %as-pseudo;
}
%main-nav-horizontal .feedback-link a::after {
@extend %with-logo-github-monochrome-icon, %as-pseudo;
}
html.ember-loading body > svg { html.ember-loading body > svg {
@extend %brand-loader; @extend %brand-loader;
} }

View File

@ -24,9 +24,6 @@
%secondary-nav { %secondary-nav {
@extend %main-nav-horizontal; @extend %main-nav-horizontal;
} }
%primary-nav label + div {
@extend %main-nav-horizontal-drop-nav;
}
@media #{$--lt-horizontal-nav} { @media #{$--lt-horizontal-nav} {
%primary-nav { %primary-nav {
margin-top: 65px; margin-top: 65px;

View File

@ -16,7 +16,7 @@
{{#if (and (eq nspaces.length 1) (not canManageNspaces)) }} {{#if (and (eq nspaces.length 1) (not canManageNspaces)) }}
<span data-test-nspace-selected={{nspace.Name}}>{{nspace.Name}}</span> <span data-test-nspace-selected={{nspace.Name}}>{{nspace.Name}}</span>
{{ else }} {{ else }}
{{#popover-menu}} {{#popover-menu position='left'}}
{{#block-slot name='trigger'}} {{#block-slot name='trigger'}}
{{nspace.Name}} {{nspace.Name}}
{{/block-slot}} {{/block-slot}}
@ -51,7 +51,7 @@
{{#if (or (not dcs) (eq dcs.length 1)) }} {{#if (or (not dcs) (eq dcs.length 1)) }}
<span data-test-datacenter-selected={{dc.Name}}>{{dc.Name}}</span> <span data-test-datacenter-selected={{dc.Name}}>{{dc.Name}}</span>
{{ else }} {{ else }}
{{#popover-menu}} {{#popover-menu position='left'}}
{{#block-slot name='trigger'}} {{#block-slot name='trigger'}}
{{dc.Name}} {{dc.Name}}
{{/block-slot}} {{/block-slot}}
@ -90,7 +90,23 @@
<nav> <nav>
<ul> <ul>
<li data-test-main-nav-docs> <li data-test-main-nav-docs>
<a href="{{ env 'CONSUL_DOCS_URL'}}" rel="help noopener noreferrer" target="_blank">Documentation</a> {{#popover-menu position='right'}}
{{#block-slot name='trigger'}}
Help
{{/block-slot}}
{{#block-slot name='menu'}}
<li role="none" class="docs-link">
<a tabindex="-1" role="menuitem" href={{env 'CONSUL_DOCS_URL'}} rel="noopener noreferrer" target="_blank">Documentation</a>
</li>
<li role="none" class="learn-link">
<a tabindex="-1" role="menuitem" href={{env 'CONSUL_DOCS_LEARN_URL'}} rel="noopener noreferrer" target="_blank">HashiCorp Learn</a>
</li>
<li role="separator"></li>
<li role="none" class="feedback-link">
<a tabindex="-1" role="menuitem" href={{env 'CONSUL_REPO_ISSUES_URL'}} target="_blank" rel="noopener noreferrer">Provide Feedback</a>
</li>
{{/block-slot}}
{{/popover-menu}}
</li> </li>
<li data-test-main-nav-settings class={{if (is-href 'settings') 'is-active'}}> <li data-test-main-nav-settings class={{if (is-href 'settings') 'is-active'}}>
<a href={{href-to 'settings'}}>Settings</a> <a href={{href-to 'settings'}}>Settings</a>

View File

@ -7,7 +7,7 @@
{{/yield-slot}} {{/yield-slot}}
</button> </button>
{{/toggle-button}} {{/toggle-button}}
<div> <div class={{position}}>
<input type="checkbox" id={{concat 'popover-menu-' guid '-'}} /> <input type="checkbox" id={{concat 'popover-menu-' guid '-'}} />
{{#each submenus as |sub|}} {{#each submenus as |sub|}}
<input type="checkbox" id={{concat 'popover-menu-' guid '-' sub}} /> <input type="checkbox" id={{concat 'popover-menu-' guid '-' sub}} />

View File

@ -71,6 +71,7 @@ module.exports = function(environment, $ = process.env) {
CONSUL_NSPACES_ENABLED: false, CONSUL_NSPACES_ENABLED: false,
CONSUL_HOME_URL: 'https://www.consul.io', CONSUL_HOME_URL: 'https://www.consul.io',
CONSUL_REPO_ISSUES_URL: 'https://github.com/hashicorp/consul/issues/new/choose',
CONSUL_DOCS_URL: 'https://www.consul.io/docs', CONSUL_DOCS_URL: 'https://www.consul.io/docs',
CONSUL_DOCS_LEARN_URL: 'https://learn.hashicorp.com/consul', CONSUL_DOCS_LEARN_URL: 'https://learn.hashicorp.com/consul',
CONSUL_DOCS_API_URL: 'https://www.consul.io/api', CONSUL_DOCS_API_URL: 'https://www.consul.io/api',