From 82ea91920adad0d25097bfc814229e48ca97dd5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 2 Oct 2023 10:38:47 -0400 Subject: [PATCH] refactor: update buildCategoryLabel --- public/src/modules/helpers.common.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/src/modules/helpers.common.js b/public/src/modules/helpers.common.js index 00b6a3fe74..07ab724963 100644 --- a/public/src/modules/helpers.common.js +++ b/public/src/modules/helpers.common.js @@ -97,15 +97,16 @@ module.exports = function (utils, Benchpress, relative_path) { return `${category.icon ? `` : ''}`; } - function buildCategoryLabel(category, className = '') { + function buildCategoryLabel(category, tag = 'a', className = '') { if (!category) { return ''; } - return ` + const href = tag === 'a' ? `href="${relative_path}/category/${category.slug}"` : ''; + return `<${tag} ${href} class="badge px-1 text-truncate text-decoration-none ${className}" style="color: ${category.color};background-color: ${category.bgColor};border-color: ${category.bgColor}!important; max-width: 70vw;"> ${category.icon && category.icon !== 'fa-nbb-none' ? `` : ''} ${category.name} - `; + `; } function generateCategoryBackground(category) {