Skip to content

A platform for community discussion. Free, open, simple.

DEV: Use a css var for the channel card border color (#36052)

Jarek Radoszb622edd66dd7
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-card.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-channel-card.gjs
index 3f1b22563b2..a2f55f24d1b 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-card.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-card.gjs
@@ -1,6 +1,6 @@
-import { hash } from "@ember/helper";
+import { concat, hash } from "@ember/helper";
import { LinkTo } from "@ember/routing";
-import borderColor from "discourse/helpers/border-color";
+import { htmlSafe } from "@ember/template";
import concatClass from "discourse/helpers/concat-class";
import icon from "discourse/helpers/d-icon";
import replaceEmoji from "discourse/helpers/replace-emoji";
@@ -16,7 +16,9 @@ const ChatChannelCard = <template>
(if @channel.isClosed "--closed")
(if @channel.isArchived "--archived")
}}
- style={{borderColor @channel.chatable.color}}
+ style={{htmlSafe
+ (concat "--chat-channel-card-border: #" @channel.chatable.color)
+ }}
data-channel-id={{@channel.id}}
>
<div class="chat-channel-card__header">
diff --git a/plugins/chat/assets/stylesheets/common/chat-channel-card.scss b/plugins/chat/assets/stylesheets/common/chat-channel-card.scss
index 06aa9e9481a..7233af0c8c9 100644
--- a/plugins/chat/assets/stylesheets/common/chat-channel-card.scss
+++ b/plugins/chat/assets/stylesheets/common/chat-channel-card.scss
@@ -1,4 +1,5 @@
.chat-channel-card {
+ --chat-channel-card-border: transparent;
display: grid;
grid-template-areas:
"title cta"
@@ -13,6 +14,7 @@
min-height: 0;
min-width: 0;
border-left: 5px solid transparent;
+ border-color: var(--chat-channel-card-border);
&.--closed,
&.--archived {