Skip to content
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(v2): properly set dark mode logo on build-time prerendering #2324

Merged
merged 1 commit into from
Feb 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions packages/docusaurus-theme-classic/src/theme/Navbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ function NavLink({activeBasePath, to, href, label, position, ...props}) {
}

function Navbar() {
const context = useDocusaurusContext();
const {siteConfig = {}} = context;
const {siteConfig = {}, isClient} = useDocusaurusContext();
const {baseUrl, themeConfig = {}} = siteConfig;
const {navbar = {}, disableDarkMode = false} = themeConfig;
const {title, logo = {}, links = [], hideOnScroll = false} = navbar;
Expand Down Expand Up @@ -124,7 +123,12 @@ function Navbar() {
</div>
<Link className="navbar__brand" to={logoLink} {...logoLinkProps}>
{logo != null && (
<img className="navbar__logo" src={logoImageUrl} alt={logo.alt} />
<img
key={isClient}
className="navbar__logo"
src={logoImageUrl}
alt={logo.alt}
/>
)}
{title != null && (
<strong
Expand Down Expand Up @@ -172,7 +176,12 @@ function Navbar() {
to={logoLink}
{...logoLinkProps}>
{logo != null && (
<img className="navbar__logo" src={logoImageUrl} alt={logo.alt} />
<img
key={isClient}
className="navbar__logo"
src={logoImageUrl}
alt={logo.alt}
/>
)}
{title != null && <strong>{title}</strong>}
</Link>
Expand Down