DEV: Use icon-rendering API for local-dates (#28788)

This makes local-dates compatible with the fa6 upgrade in https://github.com/discourse/discourse/pull/28778
This commit is contained in:
David Taylor 2024-09-06 20:51:57 +01:00 committed by GitHub
parent 24caa36eef
commit 348abeecb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 4 deletions

View File

@ -7,7 +7,7 @@ import {
addTagDecorateCallback,
addTextDecorateCallback,
} from "discourse/lib/to-markdown";
import { renderIcon } from "discourse-common/lib/icon-library";
import { iconHTML, renderIcon } from "discourse-common/lib/icon-library";
import { bind } from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import generateDateMarkup from "discourse/plugins/discourse-local-dates/lib/local-date-markup-generator";
@ -41,9 +41,7 @@ export function applyLocalDates(dates, siteSettings) {
element.innerText = "";
element.insertAdjacentHTML(
"beforeend",
`<svg class="fa d-icon d-icon-globe-americas svg-icon" xmlns="http://www.w3.org/2000/svg">
<use href="#globe-americas"></use>
</svg>
`${iconHTML("globe-americas")}
<span class="relative-time">${localDateBuilder.formatted}</span>`
);
element.setAttribute("aria-label", localDateBuilder.textPreview);