Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e2cbe81
updated the button to use the new interactive generic component
didoo Apr 20, 2022
393f330
fixed underline of text on links
didoo Apr 20, 2022
6b8441a
improved assertion guards in `button` to work differently between but…
didoo Apr 20, 2022
0c87f75
added special visual treatment to alert the developer if a `href` HTM…
didoo Apr 20, 2022
011de8d
updated documentation page for “button”
didoo Apr 20, 2022
abd2aac
updated integration tests for “button”
didoo Apr 20, 2022
cf58529
Merge branch 'spike-interactive-generic-component' into spike-button-…
didoo Apr 20, 2022
9e68782
skipped failing test in "ember-lts-3.24"
didoo Apr 20, 2022
81d5878
entirely removed `Link/LinkTo::CTA` from the HDS components
didoo Apr 20, 2022
25223ec
skipped another failing test in "ember-lts-3.24"
didoo Apr 20, 2022
821a86b
Merge branch 'spike-button-with-link-support' into spike-remove-link-CTA
didoo Apr 20, 2022
1cdd811
linting
didoo Apr 20, 2022
cf71762
Merge branch 'spike-interactive-generic-component' into spike-button-…
didoo Apr 27, 2022
b0bc06f
updated documentation following the introduction of the `@isHrefExter…
didoo Apr 27, 2022
934a3d5
forgot default
didoo Apr 27, 2022
29f79fe
Merge branch 'spike-interactive-generic-component' into spike-button-…
didoo May 5, 2022
e104fbf
added missing `isHrefExternal` to Button component
didoo May 5, 2022
c812e39
Merge branch 'spike-button-with-link-support' into spike-remove-link-CTA
didoo May 5, 2022
c8106a9
Merge branch 'spike-interactive-generic-component' into spike-button-…
didoo May 9, 2022
8faea6c
added missing test for `Button` component
didoo May 10, 2022
dba115f
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-button-with-link…
didoo May 11, 2022
3a86700
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-remove-link-CTA
didoo May 11, 2022
0a963a4
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-button-with-link…
didoo May 11, 2022
18d5662
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-remove-link-CTA
didoo May 11, 2022
4e13bcf
added a comment
didoo May 11, 2022
84388c5
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-remove-link-CTA
didoo May 11, 2022
f65348b
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-button-with-link…
didoo May 11, 2022
5571f30
Merge branch 'spike-button-with-link-support' into spike-remove-link-CTA
didoo May 11, 2022
cc4dcd7
Enable interactive links to be actioned using space
alex-ju May 18, 2022
07dd76e
Test the dispatch of a click event when pressing space key on an inte…
alex-ju May 18, 2022
e59543b
Merge pull request #291 from hashicorp/alex-ju/action-interactive-lin…
alex-ju May 18, 2022
1969434
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-button-with-link…
didoo May 18, 2022
de89138
Merge branch 'spike-button-with-link-support' into spike-remove-link-CTA
didoo May 18, 2022
2535a1d
re-added the underline to the text when `Hds::Button` is a link
didoo May 18, 2022
228e891
removed the `@type` argument in favour of the native `type` attribute…
didoo May 18, 2022
2836b6f
updated documentation after removing `@type` argument
didoo May 18, 2022
e782b79
updated tests after removing `@type` argument
didoo May 18, 2022
00573b5
removed extra test
didoo May 18, 2022
54ef3b7
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-button-with-link…
didoo May 18, 2022
ccf9988
Merge branch 'spike-button-with-link-support' into spike-remove-link-CTA
didoo May 18, 2022
885e398
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-button-with-link…
didoo May 19, 2022
237e1cb
Merge branch 'spike-button-with-link-support' into spike-remove-link-CTA
didoo May 19, 2022
dff380e
Merge pull request #221 from hashicorp/spike-remove-link-CTA
didoo May 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions packages/components/addon/components/hds/button/index.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
<button class={{this.classNames}} ...attributes aria-label={{if this.isIconOnly this.text null}} type={{this.type}}>
<Hds::Interactive
class={{this.classNames}}
@current-when={{@current-when}}
@models={{hds-link-to-models @model @models}}
@query={{hds-link-to-query @query}}
@replace={{@replace}}
@route={{@route}}
@isRouteExternal={{@isRouteExternal}}
@href={{@href}}
@isHrefExternal={{@isHrefExternal}}
...attributes
aria-label={{if this.isIconOnly this.text null}}
>
{{#if this.isIconOnly}}
<div class="hds-button__icon">
<FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />
Expand Down Expand Up @@ -26,4 +38,4 @@
</div>
{{/if}}
{{/if}}
</button>
</Hds::Interactive>
21 changes: 0 additions & 21 deletions packages/components/addon/components/hds/button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ import { assert } from '@ember/debug';

export const DEFAULT_SIZE = 'medium';
export const DEFAULT_COLOR = 'primary';
export const DEFAULT_TYPE = 'button';
export const DEFAULT_ICONPOSITION = 'leading';
export const SIZES = ['small', 'medium', 'large'];
export const COLORS = ['primary', 'secondary', 'tertiary', 'critical'];
export const TYPES = ['button', 'submit', 'reset'];
export const ICONPOSITIONS = ['leading', 'trailing'];

export default class HdsButtonIndexComponent extends Component {
Expand Down Expand Up @@ -126,25 +124,6 @@ export default class HdsButtonIndexComponent extends Component {
}
}

/**
Copy link
Contributor Author

@didoo didoo May 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the @type argument from the API in favour of the type native attribute (this simplifies the code)

Notice: by default type="button" (see Hds::Interactive code)

* @param type
* @type {string}
* @default button
* @description The value for the button's `type` attribute. Acceptable values are `button`, `submit`, and `reset`
*/
get type() {
let { type = DEFAULT_TYPE } = this.args;

assert(
`@type for "Hds::Button" must be one of the following: ${TYPES.join(
', '
)}; received: ${type}`,
TYPES.includes(type)
);

return type;
}

/**
* @param isFullWidth
* @type {boolean}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
{{! IMPORTANT: we can't support the direct use of the "href" HTML attribute via ...attributes, because we need to rely on the "@href" Ember argument to differentiate between different types of generated output }}
{{else if @href}}
{{#if this.isHrefExternal}}
<a target="_blank" rel="noopener noreferrer" ...attributes href={{@href}}>
<a target="_blank" rel="noopener noreferrer" ...attributes href={{@href}} {{on "keyup" this.onKeyUp}}>
{{yield}}
</a>
{{else}}
<a ...attributes href={{@href}}>
<a ...attributes href={{@href}} {{on "keyup" this.onKeyUp}}>
{{yield}}
</a>
{{/if}}
Expand Down
8 changes: 8 additions & 0 deletions packages/components/addon/components/hds/interactive/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Component from '@glimmer/component';
import { action } from '@ember/object';

export default class HdsInteractiveComponent extends Component {
/**
Expand All @@ -22,4 +23,11 @@ export default class HdsInteractiveComponent extends Component {
get isRouteExternal() {
return this.args.isRouteExternal ?? false;
}

@action
onKeyUp(event) {
if (event.key === ' ' || event.code === 'Space') {
event.target.click();
}
}
}
51 changes: 0 additions & 51 deletions packages/components/addon/components/hds/link-to/cta.hbs

This file was deleted.

165 changes: 0 additions & 165 deletions packages/components/addon/components/hds/link-to/cta.js

This file was deleted.

50 changes: 0 additions & 50 deletions packages/components/addon/components/hds/link/cta.hbs

This file was deleted.

Loading