Skip to content

Commit

Permalink
2353 Updates image resource path for va-icon & va-pagination (departm…
Browse files Browse the repository at this point in the history
…ent-of-veterans-affairs#1067)

* verdaccio fix ( now includes src and loader directories)

* Bump web-components/package.json by a patch version

* Add assetsDirs option to va-icon Component decorator

* removes duplicated asset directory

* update web component version

---------

Co-authored-by: Ray Messina <rmessina10@gmail.com>
Co-authored-by: Ray Messina <48040208+rmessina1010@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 28, 2024
1 parent 17cefe5 commit 6607ba6
Show file tree
Hide file tree
Showing 5 changed files with 165 additions and 117 deletions.
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"build": "webpack"
},
"files": [
"dist/*",
"dist/",
"src/",
"*.js"
],
"main": "dist/app.bundle.js",
Expand Down
5 changes: 5 additions & 0 deletions packages/core/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ module.exports = {
to: './',
context: path.resolve(__dirname, '../', 'web-components/dist'),
},
{
from: 'assets/**/*',
to: './',
context: path.resolve(__dirname, '../', 'web-components/dist'),
},
{
from: '*',
to: './components/types',
Expand Down
4 changes: 2 additions & 2 deletions packages/web-components/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ export namespace Components {
*/
"size"?: number;
/**
* Screen-reader text if the icon has semantic meaning and is not purely decorative.
* Screen-reader text if the icon has semantic meaning and is not purely decorative.
*/
"srtext"?: string;
}
Expand Down Expand Up @@ -2412,7 +2412,7 @@ declare namespace LocalJSX {
*/
"size"?: number;
/**
* Screen-reader text if the icon has semantic meaning and is not purely decorative.
* Screen-reader text if the icon has semantic meaning and is not purely decorative.
*/
"srtext"?: string;
}
Expand Down
24 changes: 9 additions & 15 deletions packages/web-components/src/components/va-icon/va-icon.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
Component,
Host,
Prop,
h,
getAssetPath
} from '@stencil/core';
import { Component, Host, Prop, h, getAssetPath } from '@stencil/core';
import classnames from 'classnames';
import { consoleDevError } from '../../utils/utils';

Expand All @@ -17,6 +11,7 @@ import { consoleDevError } from '../../utils/utils';
@Component({
tag: 'va-icon',
styleUrl: 'va-icon.scss',
assetsDirs: ['../assets'],
shadow: true,
})
export class VaIcon {
Expand All @@ -32,17 +27,15 @@ export class VaIcon {
@Prop() size?: number;

/**
* Screen-reader text if the icon has semantic meaning
* Screen-reader text if the icon has semantic meaning
* and is not purely decorative.
*/
@Prop() srtext?: string;

private getSize(): number | null {
const sizes = [3, 4, 5, 6, 7, 8, 9];
if (!!this.size && !sizes.includes(this.size)) {
consoleDevError(
`Size must be an integer between 3 and 9, inclusive.`,
);
consoleDevError(`Size must be an integer between 3 and 9, inclusive.`);
return null;
}
return this.size;
Expand All @@ -61,11 +54,12 @@ export class VaIcon {
<svg
class={iconClass}
aria-labelledby={!!srtext ? 'icon-title' : null}
aria-hidden={!!srtext ? null : "true"}
aria-hidden={!!srtext ? null : 'true'}
focusable="false"
role="img">
{srtext && <title id="icon-title">{srtext}</title>}
<use href={imageSrc}></use>
role="img"
>
{srtext && <title id="icon-title">{srtext}</title>}
<use href={imageSrc}></use>
</svg>
</Host>
);
Expand Down
Loading

0 comments on commit 6607ba6

Please sign in to comment.