banners: Add utility class for uniform bold.

This commit is contained in:
Karl Stolley
2025-07-09 13:18:20 -05:00
committed by Tim Abbott
parent ddc634682c
commit ec46b117bb
4 changed files with 16 additions and 7 deletions

View File

@@ -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;
})

View File

@@ -59,6 +59,10 @@ kbd {
font-weight: 300;
}
.highlighted-element {
font-weight: 600;
}
.inline-block {
display: inline-block;
}

View File

@@ -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>

View File

@@ -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(