From c472fa2850c1b268ccf2989ff31e4db6b6e7f1a5 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sun, 27 Nov 2022 14:33:27 -0500 Subject: [PATCH] feat: buildCategoryLabel helper (for use in harmony theme) --- public/src/modules/helpers.common.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/public/src/modules/helpers.common.js b/public/src/modules/helpers.common.js index e3f10ba528..93c7961dbc 100644 --- a/public/src/modules/helpers.common.js +++ b/public/src/modules/helpers.common.js @@ -12,6 +12,7 @@ module.exports = function (utils, Benchpress, relative_path) { escape, stripTags, buildCategoryIcon, + buildCategoryLabel, generateCategoryBackground, generateChildrenCategories, generateTopicClass, @@ -88,6 +89,17 @@ module.exports = function (utils, Benchpress, relative_path) { return `${category.icon ? `` : ''}`; } + function buildCategoryLabel(category) { + if (!category) { + return ''; + } + + return ` + ${category.icon ? `` : ''} + ${category.name} + `; + } + function generateCategoryBackground(category) { if (!category) { return '';