@1024pix/pix-ui 55.13.0 → 55.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { array } from '@ember/helper';
|
|
2
|
+
import { LinkTo } from '@ember/routing';
|
|
3
|
+
import { service } from '@ember/service';
|
|
4
|
+
import Component from '@glimmer/component';
|
|
5
|
+
|
|
6
|
+
import PixIcon from './pix-icon';
|
|
7
|
+
|
|
8
|
+
export default class PixNavigationButton extends Component {
|
|
9
|
+
defaultParams = {};
|
|
10
|
+
defaultModel = [];
|
|
11
|
+
@service router;
|
|
12
|
+
|
|
13
|
+
get isActiveRoute() {
|
|
14
|
+
return this.args.route === this.router.currentRouteName;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get isLinkOpenInANewWindow() {
|
|
18
|
+
return this.args?.target === '_blank';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
{{#if @route}}
|
|
23
|
+
<LinkTo
|
|
24
|
+
@route={{@route}}
|
|
25
|
+
@models={{if @model (array @model) this.defaultModel}}
|
|
26
|
+
@query={{if @query @query this.defaultParams}}
|
|
27
|
+
class="pix-navigation-button"
|
|
28
|
+
target={{if this.isLinkOpenInANewWindow "_blank"}}
|
|
29
|
+
...attributes
|
|
30
|
+
>
|
|
31
|
+
{{#if @icon}}
|
|
32
|
+
<PixIcon
|
|
33
|
+
class="pix-navigation-button__icon"
|
|
34
|
+
@ariaHidden={{true}}
|
|
35
|
+
@name={{@icon}}
|
|
36
|
+
@plainIcon={{if this.isActiveRoute true false}}
|
|
37
|
+
/>
|
|
38
|
+
{{/if}}
|
|
39
|
+
{{yield}}
|
|
40
|
+
{{#if this.isLinkOpenInANewWindow}}
|
|
41
|
+
<PixIcon
|
|
42
|
+
class="pix-navigation-button__external-icon"
|
|
43
|
+
@ariaHidden={{true}}
|
|
44
|
+
@name="openNew"
|
|
45
|
+
/>
|
|
46
|
+
{{/if}}
|
|
47
|
+
</LinkTo>
|
|
48
|
+
{{else}}
|
|
49
|
+
{{! template-lint-disable link-href-attributes }}
|
|
50
|
+
<a
|
|
51
|
+
class="pix-navigation-button"
|
|
52
|
+
target={{if this.isLinkOpenInANewWindow "_blank"}}
|
|
53
|
+
...attributes
|
|
54
|
+
>
|
|
55
|
+
{{#if @icon}}
|
|
56
|
+
<PixIcon
|
|
57
|
+
class="pix-navigation-button__icon"
|
|
58
|
+
@ariaHidden={{true}}
|
|
59
|
+
@name={{@icon}}
|
|
60
|
+
@plainIcon={{@iconPlain}}
|
|
61
|
+
/>
|
|
62
|
+
{{/if}}
|
|
63
|
+
{{yield}}
|
|
64
|
+
{{#if this.isLinkOpenInANewWindow}}
|
|
65
|
+
<PixIcon
|
|
66
|
+
class="pix-navigation-button__external-icon"
|
|
67
|
+
@ariaHidden={{true}}
|
|
68
|
+
@name="openNew"
|
|
69
|
+
/>
|
|
70
|
+
{{/if}}
|
|
71
|
+
</a>
|
|
72
|
+
{{/if}}
|
|
73
|
+
</template>
|
|
74
|
+
}
|
package/package.json
CHANGED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
{{#if @route}}
|
|
2
|
-
<LinkTo
|
|
3
|
-
@route={{@route}}
|
|
4
|
-
@models={{if @model (array @model) this.defaultModel}}
|
|
5
|
-
@query={{if @query @query this.defaultParams}}
|
|
6
|
-
class="pix-navigation-button"
|
|
7
|
-
target={{if this.isLinkOpenInANewWindow "_blank"}}
|
|
8
|
-
...attributes
|
|
9
|
-
>
|
|
10
|
-
{{#if @icon}}
|
|
11
|
-
<PixIcon
|
|
12
|
-
class="pix-navigation-button__icon"
|
|
13
|
-
@ariaHidden={{true}}
|
|
14
|
-
@name={{@icon}}
|
|
15
|
-
@plainIcon={{@iconPlain}}
|
|
16
|
-
/>
|
|
17
|
-
{{/if}}
|
|
18
|
-
{{yield}}
|
|
19
|
-
{{#if this.isLinkOpenInANewWindow}}
|
|
20
|
-
<PixIcon class="pix-navigation-button__external-icon" @ariaHidden={{true}} @name="openNew" />
|
|
21
|
-
{{/if}}
|
|
22
|
-
</LinkTo>
|
|
23
|
-
{{else}}
|
|
24
|
-
{{! template-lint-disable link-href-attributes }}
|
|
25
|
-
<a class="pix-navigation-button" target={{if this.isLinkOpenInANewWindow "_blank"}} ...attributes>
|
|
26
|
-
{{#if @icon}}
|
|
27
|
-
<PixIcon
|
|
28
|
-
class="pix-navigation-button__icon"
|
|
29
|
-
@ariaHidden={{true}}
|
|
30
|
-
@name={{@icon}}
|
|
31
|
-
@plainIcon={{@iconPlain}}
|
|
32
|
-
/>
|
|
33
|
-
{{/if}}
|
|
34
|
-
{{yield}}
|
|
35
|
-
{{#if this.isLinkOpenInANewWindow}}
|
|
36
|
-
<PixIcon class="pix-navigation-button__external-icon" @ariaHidden={{true}} @name="openNew" />
|
|
37
|
-
{{/if}}
|
|
38
|
-
</a>
|
|
39
|
-
{{/if}}
|