Skip to content

Commit

Permalink
Sweeping fixes to va-icon and buttons that use icons (#1140)
Browse files Browse the repository at this point in the history
* Sweeping fixes to va-icon and buttons that use icons

* Version bumps

* Adding more space between icons and text in buttons with both

* Updated va-button.e2e.ts test

* Adjustment to core version
  • Loading branch information
Andrew565 committed May 1, 2024
1 parent dcf7cd0 commit 54c94bb
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 28 deletions.
2 changes: 1 addition & 1 deletion packages/web-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@department-of-veterans-affairs/web-components",
"version": "8.0.0",
"version": "8.0.1",
"description": "Stencil Component Starter",
"main": "dist/index.cjs.js",
"module": "dist/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,5 @@

// Fix to off-centered content when icon present
:host button.usa-button va-icon {
display: inline-block;
height: 0;
vertical-align: top;
margin-right: 4px;
margin-right: 8px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ describe('va-button', () => {
<va-button back="" class="hydrated" uswds="">
<mock:shadow-root>
<button class="usa-button usa-button--outline" type="button" part="button">
<va-icon class="hydrated va-button--icon"></va-icon>
<va-icon class="hydrated margin-right-8px va-button--icon"></va-icon>
Back
</button>
</mock:shadow-root>
Expand All @@ -261,7 +261,7 @@ describe('va-button', () => {
<mock:shadow-root>
<button class="usa-button" type="button" part="button">
Continue
<va-icon class="hydrated va-button--icon"></va-icon>
<va-icon class="hydrated margin-left-8px va-button--icon"></va-icon>
</button>
</mock:shadow-root>
</va-button>
Expand Down
23 changes: 10 additions & 13 deletions packages/web-components/src/components/va-button/va-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,19 @@
}

// Fix to off-centered content in V3 when icon present
:host([back]:not([back='false'])), :host([continue]:not([continue='false'])) {
button.usa-button {
padding-top: 8px;
}
}
.va-button--icon {
display: inline-block;
height: 0;
vertical-align: text-top;
position: relative;
top: 0.1em;
&.margin-right-8px {
margin-right: 8px;
}
&.margin-left-8px {
margin-left: 8px;
}
}
:host([big]:not([big="false"]):is([back], [continue])) {
button.usa-button {
padding-top: 12px;
}
.va-button--icon {
vertical-align: sub;
.usa-button--big {
padding-top: 14px;
}
}

Expand Down
14 changes: 6 additions & 8 deletions packages/web-components/src/components/va-button/va-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,25 +180,23 @@ export class VaButton {
>
{back && !_continue && (
<va-icon
class="va-button--icon"
class="va-button--icon margin-right-8px"
icon="navigate_far_before"
size={3}
></va-icon>
)}
{buttonText}
{_continue && !back && (
<va-icon
class="va-button--icon"
class="va-button--icon margin-left-8px"
icon="navigate_far_next"
size={3}
></va-icon>
)}
</button>
{messageAriaDescribedby && (
<span id="button-description" class="usa-sr-only">
{messageAriaDescribedby}
</span>
)}
<span id="button-description" class="usa-sr-only">
{messageAriaDescribedby}
</span>
)}
</Host>
);
} else {
Expand Down
6 changes: 6 additions & 0 deletions packages/web-components/src/components/va-icon/va-icon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@
@use 'usa-icon/src/styles/_usa-icon.scss';

@import '../../global/formation_overrides';

:host {
display: inline-block;
line-height: 0;
vertical-align: bottom;
}

0 comments on commit 54c94bb

Please sign in to comment.