Skip to content

Commit a618565

Browse files
authored
Updated wins.js so Wins page uses icon-github.svg (#8379)
* Replaced the current github icon used within wins card template to the github icon with file type of svg. * Removed the line of code which set the srouce of the github icon div to the github icon saved within assets: /asstes/images/wins-page/icon-github-small.svg. Also Removed the literal definition of GITHUB_ICON where the path to this icon svg which is being replaced. Modified line where the alt property was defined for the img which used to store the svg. To comply with WCAG, we instead add the description to the aria-label using the setAttribute method. * Added styling for github-icon class and the nested svg to match the appearance of linkedin-icon class elements. Because the github-icon svg is rendered inline, the viewBox inherits a larger sizing from the source file than the Linkedin icon. Inspecting the linked-in image revealed a base size of 32px x 32px. To replicate this sizing, we set github-icon div width and height to 32px by 32px and made a rule for the svg to fill the container width and height by 100%.
1 parent 7bb9316 commit a618565

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

_includes/wins-page/wins-card-template.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
<span class="wins-card-name"> </span>
88
<span class="wins-card-icons">
99
<a target="_blank" class="wins-card-linkedin-icon"><img class="linkedin-icon" alt="" /></a>
10-
<a target="_blank" class="wins-card-github-icon"><img class="github-icon" alt="" /></a>
10+
<a target="_blank" class="wins-card-github-icon" style="color:black">
11+
<div role="img" class="github-icon">
12+
{% include svg/icon-github.svg %}
13+
</div>
14+
</a>
1115
</span>
1216
</div>
1317
<div class="project-inner wins-card-team"></div>

_sass/components/_wins-page.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,17 @@
280280
display: flex;
281281
}
282282

283+
.github-icon{
284+
width: 32px;
285+
height: 32px;
286+
max-width: 100%;
287+
}
288+
289+
.github-icon svg{
290+
width: 100%;
291+
height: 100%;
292+
}
293+
283294
@media #{$bp-below-desktop} {
284295
.wins-card {
285296
position: relative;

assets/js/wins.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@
290290
const cardTemplate = document.getElementById("wins-card-template");
291291
const QUOTE_ICON_PATH = '/assets/images/wins-page/quote-icon.svg'
292292
const AVATAR_DEFAULT_PATH = "/assets/images/wins-page/avatar-default.svg"
293-
const GITHUB_ICON = '/assets/images/wins-page/icon-github-small.svg';
294293
const LINKEDIN_ICON = '/assets/images/wins-page/icon-linkedin-small.svg'
295294
const winsCardContainer = document.querySelector('#responses');
296295

@@ -330,8 +329,7 @@
330329

331330
if (card[github_url].length > 0){
332331
cloneCardTemplate.querySelector('.wins-card-github-icon').href = card[github_url];
333-
cloneCardTemplate.querySelector('.github-icon').src = GITHUB_ICON ;
334-
cloneCardTemplate.querySelector('.github-icon').alt = `GitHub profile for ${card[name]}`;
332+
cloneCardTemplate.querySelector('.github-icon').setAttribute('aria-label' ,`GitHub profile for ${card[name]}`);
335333
} else {
336334
cloneCardTemplate.querySelector('.wins-card-github-icon').setAttribute('hidden', 'true')
337335
}

0 commit comments

Comments
 (0)