FEATURE: Apply hashtag styles to autocomplete (#21731)
This commit uses improvements done in 0b3cf83
to apply these styles to the autocomplete in composer.
This commit is contained in:
parent
398eaf0429
commit
eae47d82e2
|
@ -239,6 +239,12 @@ function _searchRequest(term, contextualHashtagConfiguration, resultFunc) {
|
|||
response.results?.forEach((result) => {
|
||||
// Convert :emoji: in the result text to HTML safely.
|
||||
result.text = htmlSafe(emojiUnescape(escapeExpression(result.text)));
|
||||
|
||||
const hashtagType = getHashtagTypeClasses()[result.type];
|
||||
result.icon = hashtagType.generateIconHTML({
|
||||
icon: result.icon,
|
||||
id: result.id,
|
||||
});
|
||||
});
|
||||
resultFunc(response.results || CANCELLED_STATUS);
|
||||
})
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<ul>
|
||||
{{#each options as |option|}}
|
||||
<li class="hashtag-autocomplete__option">
|
||||
<a class="hashtag-autocomplete__link" title="{{option.description}}" href>{{d-icon option.icon}}<span class="hashtag-autocomplete__text">{{option.text}}{{#if option.secondary_text}}<span class="hashtag-autocomplete__meta-text">({{option.secondary_text}}){{/if}}</span></span>
|
||||
<a class="hashtag-autocomplete__link" title="{{option.description}}" href>{{{option.icon}}}<span class="hashtag-autocomplete__text">{{option.text}}{{#if option.secondary_text}}<span class="hashtag-autocomplete__meta-text">({{option.secondary_text}}){{/if}}</span></span>
|
||||
</a>
|
||||
</li>
|
||||
{{/each}}
|
||||
|
|
|
@ -90,9 +90,16 @@ a.hashtag-cooked {
|
|||
}
|
||||
|
||||
.d-icon {
|
||||
color: var(--primary-medium);
|
||||
margin-right: 0.25em;
|
||||
}
|
||||
|
||||
.hashtag-category-badge {
|
||||
flex: 0 0 auto;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
margin-right: 5px;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
&__text {
|
||||
|
|
|
@ -20,7 +20,7 @@ export default class ChannelHashtagType extends HashtagTypeBase {
|
|||
|
||||
generateColorCssClasses(channel) {
|
||||
return [
|
||||
`.hashtag-cooked .d-icon.hashtag-color--${this.type}-${channel.id} { color: var(--category-${channel.chatable.id}-color); }`,
|
||||
`.d-icon.hashtag-color--${this.type}-${channel.id} { color: var(--category-${channel.chatable.id}-color); }`,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ acceptance("Chat | Hashtag CSS Generator", function (needs) {
|
|||
assert.equal(
|
||||
cssTag.innerHTML,
|
||||
|
||||
".hashtag-color--category-1 {\n background: linear-gradient(90deg, var(--category-1-color) 50%, var(--category-1-color) 50%);\n}\n.hashtag-color--category-2 {\n background: linear-gradient(90deg, var(--category-2-color) 50%, var(--category-2-color) 50%);\n}\n.hashtag-color--category-4 {\n background: linear-gradient(90deg, var(--category-4-color) 50%, var(--category-1-color) 50%);\n}\n.hashtag-cooked .d-icon.hashtag-color--channel-44 { color: var(--category-1-color); }\n.hashtag-cooked .d-icon.hashtag-color--channel-74 { color: var(--category-2-color); }\n.hashtag-cooked .d-icon.hashtag-color--channel-88 { color: var(--category-4-color); }"
|
||||
".hashtag-color--category-1 {\n background: linear-gradient(90deg, var(--category-1-color) 50%, var(--category-1-color) 50%);\n}\n.hashtag-color--category-2 {\n background: linear-gradient(90deg, var(--category-2-color) 50%, var(--category-2-color) 50%);\n}\n.hashtag-color--category-4 {\n background: linear-gradient(90deg, var(--category-4-color) 50%, var(--category-1-color) 50%);\n}\n.d-icon.hashtag-color--channel-44 { color: var(--category-1-color); }\n.d-icon.hashtag-color--channel-74 { color: var(--category-2-color); }\n.d-icon.hashtag-color--channel-88 { color: var(--category-4-color); }"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue