John Cowen 82a62cd2ed
ui: Sidebar navigation / redesign (#9553)
* CSS for moving from a horizontal main menu to a side/vertical one
* Add <App /> Component and rearrange <HashcorpConsul /> to use it

1. HashicorpConsul now uses <App />
2. <App /> is now translated and adds 'skip to main content' functionality
3. Adds ember-in-viewport addon in order to visibly hide main navigation
items in order to take them out of focus/tabbing
4. Slight amends to the dom service while I was there
2021-01-26 17:40:33 +00:00

32 lines
620 B
JavaScript

import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
export default class AppComponent extends Component {
@service('dom') dom;
constructor(args, owner) {
super(...arguments);
this.guid = this.dom.guid(this);
}
@action
keypressClick(e) {
e.target.dispatchEvent(new MouseEvent('click'));
}
@action
focus(e) {
const href = e.target.getAttribute('href');
if (href.startsWith('#')) {
e.preventDefault();
this.dom.focus(href);
}
}
@action
unfocus(e) {
e.target.blur();
}
}