mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-09 23:27:28 +02:00
fix(v2): properly set dark mode logo on build-time prerendering (#2324)
This commit is contained in:
parent
37dff050ce
commit
6670c53d18
1 changed files with 13 additions and 4 deletions
|
@ -51,8 +51,7 @@ function NavLink({activeBasePath, to, href, label, position, ...props}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function Navbar() {
|
function Navbar() {
|
||||||
const context = useDocusaurusContext();
|
const {siteConfig = {}, isClient} = useDocusaurusContext();
|
||||||
const {siteConfig = {}} = context;
|
|
||||||
const {baseUrl, themeConfig = {}} = siteConfig;
|
const {baseUrl, themeConfig = {}} = siteConfig;
|
||||||
const {navbar = {}, disableDarkMode = false} = themeConfig;
|
const {navbar = {}, disableDarkMode = false} = themeConfig;
|
||||||
const {title, logo = {}, links = [], hideOnScroll = false} = navbar;
|
const {title, logo = {}, links = [], hideOnScroll = false} = navbar;
|
||||||
|
@ -124,7 +123,12 @@ function Navbar() {
|
||||||
</div>
|
</div>
|
||||||
<Link className="navbar__brand" to={logoLink} {...logoLinkProps}>
|
<Link className="navbar__brand" to={logoLink} {...logoLinkProps}>
|
||||||
{logo != null && (
|
{logo != null && (
|
||||||
<img className="navbar__logo" src={logoImageUrl} alt={logo.alt} />
|
<img
|
||||||
|
key={isClient}
|
||||||
|
className="navbar__logo"
|
||||||
|
src={logoImageUrl}
|
||||||
|
alt={logo.alt}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
{title != null && (
|
{title != null && (
|
||||||
<strong
|
<strong
|
||||||
|
@ -172,7 +176,12 @@ function Navbar() {
|
||||||
to={logoLink}
|
to={logoLink}
|
||||||
{...logoLinkProps}>
|
{...logoLinkProps}>
|
||||||
{logo != null && (
|
{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>}
|
{title != null && <strong>{title}</strong>}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue