summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/lib
diff options
context:
space:
mode:
authorClement Ho <ClemMakesApps@gmail.com>2017-10-12 12:43:00 -0500
committerClement Ho <ClemMakesApps@gmail.com>2017-10-12 12:43:00 -0500
commit13b299f4ff06a045269937f9e5fce5991bfca2d8 (patch)
treedc6ceb5dbf4608fef3b902336beff7fc8259dd79 /app/assets/javascripts/lib
parent05f46b820ee607715a9c23beabd98553d64556e0 (diff)
downloadgitlab-ce-13b299f4ff06a045269937f9e5fce5991bfca2d8.tar.gz
Add ability to pass class name to spriteIcon helpersprite-icon-class
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r--app/assets/javascripts/lib/utils/common_utils.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js
index 9f05cf16967..07899777a1e 100644
--- a/app/assets/javascripts/lib/utils/common_utils.js
+++ b/app/assets/javascripts/lib/utils/common_utils.js
@@ -403,7 +403,11 @@ export const setCiStatusFavicon = (pageUrl) => {
});
};
-export const spriteIcon = icon => `<svg><use xlink:href="${gon.sprite_icons}#${icon}" /></svg>`;
+export const spriteIcon = (icon, className = '') => {
+ const classAttribute = className.length > 0 ? `class="${className}"` : '';
+
+ return `<svg ${classAttribute}><use xlink:href="${gon.sprite_icons}#${icon}" /></svg>`;
+};
export const imagePath = imgUrl => `${gon.asset_host || ''}${gon.relative_url_root || ''}/assets/${imgUrl}`;