-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathau-main-header.gts
93 lines (87 loc) · 2.4 KB
/
au-main-header.gts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import { on } from '@ember/modifier';
import { action } from '@ember/object';
import { LinkTo } from '@ember/routing';
import type RouterService from '@ember/routing/router-service';
import { service } from '@ember/service';
import Component from '@glimmer/component';
import AuBrand from './au-brand';
import AuLink from './au-link';
import { QuestionCircleIcon } from './icons/question-circle';
export interface AuMainHeaderSignature {
Args: {
appTitle: string;
brandLink?: string;
contactRoute?: string;
homeRoute?: string;
};
Blocks: {
default: [];
};
Element: HTMLElement;
}
export default class AuMainHeader extends Component<AuMainHeaderSignature> {
@action
headerLinkFocus() {
document.querySelector<HTMLElement>('#main')?.focus();
}
<template>
<header class="au-c-main-header" ...attributes>
<div class="au-c-main-header__title-group">
<NavigationNarrator />
<AuBrand @link="{{@brandLink}}" />
{{#if @homeRoute}}
<LinkTo
@route={{@homeRoute}}
class="au-c-main-header__title au-c-main-header__title--link"
{{on "click" this.headerLinkFocus}}
>
{{@appTitle}}
</LinkTo>
{{else}}
<p class="au-c-main-header__title">
{{@appTitle}}
</p>
{{/if}}
<a href="#content" class="au-c-main-header__skiplink">
Naar de hoofdinhoud
</a>
</div>
<nav class="au-c-main-header__actions">
<ul class="au-c-list-horizontal">
{{#if @contactRoute}}
<li class="au-c-list-horizontal__item">
<AuLink
@route={{@contactRoute}}
@skin="secondary"
@icon={{QuestionCircleIcon}}
>
Contacteer ons
</AuLink>
</li>
{{/if}}
<li class="au-c-list-horizontal__item">
{{yield}}
</li>
</ul>
</nav>
</header>
</template>
}
class NavigationNarrator extends Component {
@service declare router: RouterService;
get activeRoute() {
return 'Nieuwe pagina: ' + this.router.currentRouteName;
}
<template>
<div
aria-live="assertive"
aria-controls="main"
aria-atomic="true"
aria-relevant="all"
>
<span class="au-u-hidden-visually">
{{this.activeRoute}}
</span>
</div>
</template>
}