Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

banners: Add utility class for uniform bold.

Karl Stolleyec46b117bb76
diff --git a/web/src/util.ts b/web/src/util.ts
index 93551228bf5..142b48dade3 100644
--- a/web/src/util.ts
+++ b/web/src/util.ts
@@ -456,7 +456,12 @@ export function format_array_as_list_with_highlighted_elements(
): string {
// If Intl.ListFormat is not supported
if (Intl.ListFormat === undefined) {
- return array.map((item) => `<b>${Handlebars.Utils.escapeExpression(item)}</b>`).join(", ");
+ return array
+ .map(
+ (item) =>
+ `<b class="highlighted-element">${Handlebars.Utils.escapeExpression(item)}</b>`,
+ )
+ .join(", ");
}
// Use Intl.ListFormat to format the array as a Internationalized list.
@@ -469,7 +474,7 @@ export function format_array_as_list_with_highlighted_elements(
// items), and literals (commas, etc.). We need to
// HTML-escape the elements, but not the literals.
if (part.type === "element") {
- return `<b>${Handlebars.Utils.escapeExpression(part.value)}</b>`;
+ return `<b class="highlighted-element">${Handlebars.Utils.escapeExpression(part.value)}</b>`;
}
return part.value;
})
diff --git a/web/styles/app_components.css b/web/styles/app_components.css
index 4e003783eeb..fef69e25fac 100644
--- a/web/styles/app_components.css
+++ b/web/styles/app_components.css
@@ -59,6 +59,10 @@ kbd {
font-weight: 300;
}
+.highlighted-element {
+ font-weight: 600;
+}
+
.inline-block {
display: inline-block;
}
diff --git a/web/templates/modal_banner/unsubscribed_participants_warning_banner.hbs b/web/templates/modal_banner/unsubscribed_participants_warning_banner.hbs
index 901f01dac69..7e74939978c 100644
--- a/web/templates/modal_banner/unsubscribed_participants_warning_banner.hbs
+++ b/web/templates/modal_banner/unsubscribed_participants_warning_banner.hbs
@@ -4,20 +4,20 @@
{{#tr}}
Message sender <z-user-names></z-user-names> is not subscribed to &nbsp;<z-stream></z-stream>.
{{#*inline "z-user-names"}}({{{unsubscribed_participant_formatted_names_list}}}){{/inline}}
- {{#*inline "z-stream"}}<strong>{{> ../inline_decorated_channel_name stream=stream show_colored_icon=true}}</strong>{{/inline}}
+ {{#*inline "z-stream"}}<strong class="highlighted-element">{{> ../inline_decorated_channel_name stream=stream show_colored_icon=true}}</strong>{{/inline}}
{{/tr}}
{{else if few_unsubscribed_participants}}
{{#tr}}
Some topic participants <z-user-names></z-user-names> are not subscribed to &nbsp;<z-stream></z-stream>.
{{#*inline "z-user-names"}}({{{unsubscribed_participant_formatted_names_list}}}){{/inline}}
- {{#*inline "z-stream"}}<strong>{{> ../inline_decorated_channel_name stream=stream show_colored_icon=true}}</strong>{{/inline}}
+ {{#*inline "z-stream"}}<strong class="highlighted-element">{{> ../inline_decorated_channel_name stream=stream show_colored_icon=true}}</strong>{{/inline}}
{{/tr}}
{{else}}
{{#tr}}
{unsubscribed_participants_count} topic participants are not subscribed to &nbsp;<z-stream></z-stream>.
- {{#*inline "z-stream"}}<strong>{{> ../inline_decorated_channel_name stream=stream show_colored_icon=true}}</strong>{{/inline}}
+ {{#*inline "z-stream"}}<strong class="highlighted-element">{{> ../inline_decorated_channel_name stream=stream show_colored_icon=true}}</strong>{{/inline}}
{{/tr}}
{{/if}}
</p>
diff --git a/web/tests/util.test.cjs b/web/tests/util.test.cjs
index 8081ccf4d9b..79fa28e2afe 100644
--- a/web/tests/util.test.cjs
+++ b/web/tests/util.test.cjs
@@ -369,7 +369,7 @@ run_test("format_array_as_list", () => {
);
assert.equal(
util.format_array_as_list_with_highlighted_elements(array, "long", "conjunction"),
- "<b>apple</b>, <b>banana</b>, and <b>orange</b>",
+ '<b class="highlighted-element">apple</b>, <b class="highlighted-element">banana</b>, and <b class="highlighted-element">orange</b>',
);
// Conjunction format
@@ -391,7 +391,7 @@ run_test("format_array_as_list", () => {
);
assert.equal(
util.format_array_as_list_with_highlighted_elements(array, "long", "conjunction"),
- "<b>apple</b>, <b>banana</b>, <b>orange</b>",
+ '<b class="highlighted-element">apple</b>, <b class="highlighted-element">banana</b>, <b class="highlighted-element">orange</b>',
);
assert.equal(