From 7e463ba574ec1c4b2fed87c9538af0b8768bc798 Mon Sep 17 00:00:00 2001 From: Dimitri Date: Fri, 15 Nov 2024 18:23:40 +0000 Subject: [PATCH] FEATURE: adds Dark and Light mode for Brand Logo (#59) Co-authored-by: Kris --- .../components/brand-header-contents.gjs | 24 ++++++++++++++----- settings.yaml | 2 ++ spec/system/viewing_brand_header_spec.rb | 1 + 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/javascripts/discourse/components/brand-header-contents.gjs b/javascripts/discourse/components/brand-header-contents.gjs index 14cb1d5..86591bb 100644 --- a/javascripts/discourse/components/brand-header-contents.gjs +++ b/javascripts/discourse/components/brand-header-contents.gjs @@ -1,5 +1,6 @@ import Component from "@glimmer/component"; import { service } from "@ember/service"; +import LightDarkImg from "discourse/components/light-dark-img"; import dIcon from "discourse-common/helpers/d-icon"; export default class BrandHeaderContents extends Component { @@ -14,10 +15,17 @@ export default class BrandHeaderContents extends Component { const mobileLogoUrl = settings.mobile_logo_url || ""; const showMobileLogo = mobileView && mobileLogoUrl.length > 0; const logoUrl = settings.logo_url || ""; + const logoDarkUrl = settings.logo_dark_url || ""; const title = settings.brand_name; return { - url: showMobileLogo ? mobileLogoUrl : logoUrl, + mobileUrl: showMobileLogo ? mobileLogoUrl : null, + lightImg: { + url: logoUrl, + }, + darkImg: { + url: logoDarkUrl, + }, title, }; } @@ -33,17 +41,21 @@ export default class BrandHeaderContents extends Component {