Skip to content

Commit

Permalink
fix(v2) set dark logo on SSR properly
Browse files Browse the repository at this point in the history
  • Loading branch information
lex111 committed Feb 25, 2020
1 parent 9015e79 commit ec182a5
Showing 1 changed file with 13 additions and 4 deletions.
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

0 comments on commit ec182a5

Please sign in to comment.