From fd8b0b7cc8c88b3774a666139f3c6f0f8b1fc52c Mon Sep 17 00:00:00 2001 From: Rufus Pollock Date: Wed, 14 Sep 2022 11:21:26 +0200 Subject: [PATCH] [#111,tmpl/default,nav][s]: even cleaner refactor of work in 1bf47bb4123c19bbb0cc57fe6ea3a4bd8a137bb4. --- templates/default/components/Nav.js | 36 +++++++++++++++-------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/templates/default/components/Nav.js b/templates/default/components/Nav.js index b7c6b87e0..39f0db511 100644 --- a/templates/default/components/Nav.js +++ b/templates/default/components/Nav.js @@ -15,26 +15,28 @@ function GitHubIcon(props) { } function NavbarTitle() { - // include option to define different text from title (if needed) in config - const title = siteConfig.navbarTitle?.text || siteConfig.title - - return ( + const chunk = ( <> - - - {siteConfig.navbarTitle?.logo && {title}} - {title} - {siteConfig.navbarTitle?.version && - ( -
- {siteConfig.navbarTitle?.version} -
- ) - } -
- + {siteConfig.navbarTitle?.logo && {siteConfig.navbarTitle.text}} + {siteConfig.navbarTitle?.text} + {siteConfig.navbarTitle?.version && + ( +
+ {siteConfig.navbarTitle?.version} +
+ ) + } ) + + return ( + + + {siteConfig.navbarTitle && chunk} + {!siteConfig.navbarTitle && siteConfig.title} + + + ) } export default function Header() {