Skip to content

Commit

Permalink
[#111,tmpl/default,nav][s]: even cleaner refactor of work in 1bf47bb.
Browse files Browse the repository at this point in the history
  • Loading branch information
rufuspollock committed Sep 14, 2022
1 parent c3ddd63 commit 1643a60
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions templates/default/components/Nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
<>
<Link href="/" aria-label="Home page">
<a className="flex items-center font-extrabold text-xl sm:text-2xl text-slate-900 dark:text-white">
{siteConfig.navbarTitle?.logo && <img src={siteConfig.navbarTitle.logo} alt={title} className="w-9 h-9 mr-1 fill-white" />}
{title}
{siteConfig.navbarTitle?.version &&
(
<div className="mx-2 rounded-full border border-slate-500 py-1 px-3 text-xs text-slate-500">
{siteConfig.navbarTitle?.version}
</div>
)
}
</a>
</Link>
{siteConfig.navbarTitle?.logo && <img src={siteConfig.navbarTitle.logo} alt={siteConfig.navbarTitle.text} className="w-9 h-9 mr-1 fill-white" />}
{siteConfig.navbarTitle?.text}
{siteConfig.navbarTitle?.version &&
(
<div className="mx-2 rounded-full border border-slate-500 py-1 px-3 text-xs text-slate-500">
{siteConfig.navbarTitle?.version}
</div>
)
}
</>
)

return (
<Link href="/" aria-label="Home page">
<a className="flex items-center font-extrabold text-xl sm:text-2xl text-slate-900 dark:text-white">
{siteConfig.navbarTitle && chunk}
{!siteConfig.navbarTitle && siteConfig.title}
</a>
</Link>
)
}

export default function Header() {
Expand Down

0 comments on commit 1643a60

Please sign in to comment.