Skip to content

Commit fbc3074

Browse files
committed
Make path to flag icon a prop
1 parent 086c586 commit fbc3074

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

custom-elements.json

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,16 @@
9898
}
9999
],
100100
"members": [
101+
{
102+
"kind": "field",
103+
"name": "flagSrc",
104+
"privacy": "public",
105+
"type": {
106+
"text": "string"
107+
},
108+
"default": "usFlagSmall",
109+
"attribute": "flagSrc"
110+
},
101111
{
102112
"kind": "field",
103113
"name": "lang",
@@ -214,6 +224,15 @@
214224
"fieldName": "tld",
215225
"propName": "tld"
216226
},
227+
{
228+
"name": "flagSrc",
229+
"type": {
230+
"text": "string"
231+
},
232+
"default": "usFlagSmall",
233+
"fieldName": "flagSrc",
234+
"propName": "flagsrc"
235+
},
217236
{
218237
"name": "isOpen",
219238
"type": {
@@ -241,14 +260,6 @@
241260
"name": "UsaBanner",
242261
"module": "src/components/usa-banner/index.ts"
243262
}
244-
},
245-
{
246-
"kind": "custom-element-definition",
247-
"name": "usa-banner",
248-
"declaration": {
249-
"name": "UsaBanner",
250-
"module": "src/components/usa-banner/index.ts"
251-
}
252263
}
253264
]
254265
},
@@ -351,14 +362,6 @@
351362
"name": "UsaLink",
352363
"module": "src/components/usa-link/index.ts"
353364
}
354-
},
355-
{
356-
"kind": "custom-element-definition",
357-
"name": "usa-link",
358-
"declaration": {
359-
"name": "UsaLink",
360-
"module": "src/components/usa-link/index.ts"
361-
}
362365
}
363366
]
364367
}

src/components/usa-banner/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,15 @@ const USA_BANNER_TRANSLATIONS: Record<
112112
*/
113113
export class UsaBanner extends LitElement {
114114
static properties = {
115+
flagSrc: { type: String },
115116
lang: { type: String, reflect: true },
116117
isOpen: { state: true },
117118
label: { type: String },
118119
tld: { type: String, reflect: true },
119120
};
120121

121122
// Property declarations
123+
flagSrc!: string;
122124
lang!: "en" | "es";
123125
isOpen!: boolean;
124126
label!: string;
@@ -134,6 +136,7 @@ export class UsaBanner extends LitElement {
134136

135137
constructor() {
136138
super();
139+
this.flagSrc = usFlagSmall;
137140
this.lang = "en";
138141
this.isOpen = false;
139142
this.tld = "gov";
@@ -230,7 +233,7 @@ export class UsaBanner extends LitElement {
230233
<img
231234
aria-hidden="true"
232235
class="header-flag"
233-
src=${usFlagSmall}
236+
src=${this.flagSrc}
234237
alt=""
235238
/>
236239
</div>

0 commit comments

Comments
 (0)