New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX: Use the category logo matching the theme #24033
Conversation
This commit fixes a bug in which the dark category logo would be used in a light theme if the system preferences were set to dark and the user forced the use of a light theme in Discourse
import CdnImg from "discourse/components/cdn-img"; | ||
import { getURLWithCDN } from "discourse-common/lib/get-url"; | ||
|
||
export default class LightDarkImg extends Component { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created this component because this pair of light/dark images can be used in the future in other places.
I'm just not sure about the name, I couldn't think of anything better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of a better name, either.
<template> | ||
{{#if this.isDarkImageAvailable}} | ||
<picture> | ||
<source |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reasons we can't use the <CdnImg
component here instead of relying on darkImgCndSrc
? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we're using it in a <source>
tag. <CdnImg>
is an <img>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
import CdnImg from "discourse/components/cdn-img"; | ||
import { getURLWithCDN } from "discourse-common/lib/get-url"; | ||
|
||
export default class LightDarkImg extends Component { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of a better name, either.
This commit fixes a bug in which the dark category logo would be used in a light theme if the system preference was set to dark and the user forced the use of a light theme in Discourse