-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
feat(v2): allow to specify different logo for dark mode #2261
Conversation
@@ -77,7 +77,8 @@ function Navbar() { | |||
target: '_blank', | |||
} | |||
: null; | |||
const logoImageUrl = useBaseUrl(logo.src); | |||
const logoSrc = logo.darkSrc && isDarkTheme ? logo.darkSrc : logo.src; |
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.
Maybe is it better to move this expression to the hook call?
const logoImageUrl = useBaseUrl(logo.darkSrc && isDarkTheme ? logo.darkSrc : logo.src);
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.
Both are acceptable.
website/docs/theme-classic.md
Outdated
@@ -57,6 +57,7 @@ module.exports = { | |||
logo: { | |||
alt: 'Site Logo', | |||
src: 'img/logo.svg', | |||
darkSrc: 'img/logo_dark.svg', // default to logo.src |
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.
Maybe is it better to rename to srcDark
or just dark
?
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 think srcDark
would be better.
Deploy preview for docusaurus-2 ready! Built with commit c80c00c |
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.
Awesome, self-merge please!
website/docs/theme-classic.md
Outdated
@@ -57,6 +57,7 @@ module.exports = { | |||
logo: { | |||
alt: 'Site Logo', | |||
src: 'img/logo.svg', | |||
darkSrc: 'img/logo_dark.svg', // default to logo.src |
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 think srcDark
would be better.
@@ -77,7 +77,8 @@ function Navbar() { | |||
target: '_blank', | |||
} | |||
: null; | |||
const logoImageUrl = useBaseUrl(logo.src); | |||
const logoSrc = logo.darkSrc && isDarkTheme ? logo.darkSrc : logo.src; |
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.
Both are acceptable.
Motivation
Resolving of https://docusaurus.canny.io/admin/board/feature-requests/p/specify-different-dark-mode-logo
Since we have dark mode enabled by default, it makes sense to give our users the ability to set a different logo for dark mode.
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Specify
logo.darkSrc
filed and switch to dark mode to make sure the logo has changed.Related PRs
(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)