mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
banners: Add utility class for uniform bold.
This commit is contained in:
@@ -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;
|
||||
})
|
||||
|
||||
@@ -59,6 +59,10 @@ kbd {
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.highlighted-element {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.inline-block {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
@@ -4,20 +4,20 @@
|
||||
{{#tr}}
|
||||
Message sender <z-user-names></z-user-names> is not subscribed to <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 <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 <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>
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user