Skip to content

Commit 0d54c25

Browse files
authored
Merge pull request #227 from hashicorp/spike-unify-link-standalone
Unify "Link/LinkTo::Standalone" component (04)
2 parents f43fae3 + 59d8e60 commit 0d54c25

File tree

16 files changed

+293
-769
lines changed

16 files changed

+293
-769
lines changed

packages/components/addon/components/hds/link-to/standalone.hbs

Lines changed: 0 additions & 25 deletions
This file was deleted.

packages/components/addon/components/hds/link-to/standalone.js

Lines changed: 0 additions & 151 deletions
This file was deleted.

packages/components/addon/components/hds/link/standalone.hbs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
1-
{{! template-lint-disable link-href-attributes }}
2-
{{! we can disable this linting rule because the developer will add the html attribute themselves }}
3-
<a class={{this.classNames}} target="_blank" rel="noopener noreferrer" ...attributes>
1+
<Hds::Interactive
2+
class={{this.classNames}}
3+
@current-when={{@current-when}}
4+
@models={{hds-link-to-models @model @models}}
5+
@query={{hds-link-to-query @query}}
6+
@replace={{@replace}}
7+
@route={{@route}}
8+
@isRouteExternal={{@isRouteExternal}}
9+
@href={{@href}}
10+
@isHrefExternal={{@isHrefExternal}}
11+
target="_blank"
12+
rel="noopener noreferrer"
13+
...attributes
14+
>
415
{{#if (eq this.iconPosition "leading")}}
516
<div class="hds-link-standalone__icon">
617
<FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />
@@ -16,5 +27,4 @@
1627
<FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />
1728
</div>
1829
{{/if}}
19-
</a>
20-
{{! template-lint-enable link-href-attributes }}
30+
</Hds::Interactive>

packages/components/addon/components/hds/link/standalone.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ export const COLORS = ['primary', 'secondary'];
99
export const SIZES = ['small', 'medium', 'large'];
1010

1111
export default class HdsLinkStandaloneComponent extends Component {
12+
constructor() {
13+
super(...arguments);
14+
if (!(this.args.href || this.args.route)) {
15+
assert('@href or @route must be defined for <Hds::Link::Standalone>');
16+
}
17+
}
18+
1219
/**
1320
* @param text
1421
* @type {string}

packages/components/app/components/hds/link-to/standalone.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/components/tests/acceptance/percy-test.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ module('Acceptance | Percy test', function (hooks) {
5050
await visit('/components/link/standalone');
5151
await percySnapshot('Link Standalone');
5252

53-
await visit('/components/link-to/standalone');
54-
await percySnapshot('LinkTo Standalone');
55-
5653
assert.ok(true);
5754
});
5855
});

packages/components/tests/dummy/app/components/dummy-link-cta-button-banner/index.hbs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
<code>Link::Inline</code>
66
[soon available] within a body of text and
77
<LinkTo @route="components.link.standalone"><code>Link::Standalone</code></LinkTo>
8-
or
9-
<LinkTo @route="components.link-to.standalone"><code>LinkTo::Standalone</code></LinkTo>
108
outside of a body of text, ie. on its own or in a list.</p>
119
<h4>When to use a CTA</h4>
1210
<p>A CTA is a link that looks like a button. It navigates the user to a new destination via a URL or route, but has

packages/components/tests/dummy/app/router.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Router.map(function () {
2525
this.route('cta');
2626
});
2727
this.route('link-to', function () {
28-
this.route('standalone');
2928
this.route('cta');
3029
});
3130
this.route('dropdown');

packages/components/tests/dummy/app/routes/components/link-to/standalone.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/components/tests/dummy/app/styles/app.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@import "./pages/db-focus-ring";
1515
@import "./pages/db-icon-tile";
1616
@import "./pages/db-interactive";
17-
@import "./pages/db-link";
17+
@import "./pages/db-link-standalone";
1818
@import "./pages/db-tokens";
1919
@import "./pages/db-typography";
2020

0 commit comments

Comments
 (0)