From 828c646aab99586966134d951a5817eace8caf45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Saquetim?= <1108771+megothss@users.noreply.github.com> Date: Mon, 13 Jan 2025 15:39:00 -0300 Subject: [PATCH] DEV: Add `latest-topic-list-item-class` value transformer (#30718) Add transformer to enable adding classes to the component `LatestTopicListItem` --- .../topic-list/latest-topic-list-item.gjs | 8 +++++ .../discourse/app/lib/transformer/registry.js | 7 ++-- .../latest-topic-list-item-test.gjs | 36 +++++++++++++++++++ 3 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 app/assets/javascripts/discourse/tests/integration/components/latest-topic-list-item-test.gjs diff --git a/app/assets/javascripts/discourse/app/components/topic-list/latest-topic-list-item.gjs b/app/assets/javascripts/discourse/app/components/topic-list/latest-topic-list-item.gjs index 040eedd471c..87a388c95e5 100644 --- a/app/assets/javascripts/discourse/app/components/topic-list/latest-topic-list-item.gjs +++ b/app/assets/javascripts/discourse/app/components/topic-list/latest-topic-list-item.gjs @@ -13,12 +13,19 @@ import discourseTags from "discourse/helpers/discourse-tags"; import formatDate from "discourse/helpers/format-date"; import topicFeaturedLink from "discourse/helpers/topic-featured-link"; import topicLink from "discourse/helpers/topic-link"; +import { applyValueTransformer } from "discourse/lib/transformer"; export default class LatestTopicListItem extends Component { get tagClassNames() { return this.args.topic.tags?.map((tagName) => `tag-${tagName}`); } + get additionalClasses() { + return applyValueTransformer("latest-topic-list-item-class", [], { + topic: this.args.topic, + }); + } +