-
Notifications
You must be signed in to change notification settings - Fork 109
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
[#111]: Backport changes from ecosystem #161
Changes from all commits
7ce5127
77a59c3
b5ca3f5
2aa66d8
d5a607e
439ecbe
1e619f4
0192243
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
NEXT_PUBLIC_DOCSEARCH_APP_ID=R2IYF7ETH7 | ||
NEXT_PUBLIC_DOCSEARCH_API_KEY=599cec31baffa4868cae4e79f180729b | ||
NEXT_PUBLIC_DOCSEARCH_INDEX_NAME=docsearch |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,36 @@ function GitHubIcon(props) { | |
); | ||
} | ||
|
||
function NavbarTitle() { | ||
// include option to define different text from title (if needed) in config | ||
const title = siteConfig.navbarTitle?.text || siteConfig.title | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Personally, i would be strict and say if you use navbarTitle you have to set title in their too i.e. this is:
Why? Explicitness is better than magic! |
||
/** | ||
* Navbar logo will not show if: | ||
* - the authorLogo is not defined, or | ||
* - explicitly set to false in config's navbarTitle logo property. | ||
* In all other cases the logo is shown by default. | ||
*/ | ||
const logo = (siteConfig.navbarTitle?.logo === false ? false : siteConfig.authorLogo) && siteConfig.authorLogo | ||
|
||
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"> | ||
{logo && <img src={logo} alt={title} className="w-9 h-9 mr-1 fill-white" />} | ||
{title} | ||
</a> | ||
</Link> | ||
{siteConfig.navbarTitle?.version && | ||
( | ||
<div className="mx-4 rounded-full border border-slate-500 py-1 px-3 text-xs text-slate-500"> | ||
{siteConfig.version} | ||
</div> | ||
) | ||
} | ||
</> | ||
) | ||
} | ||
|
||
export default function Header() { | ||
const router = useRouter(); | ||
const [isScrolled, setIsScrolled] = useState(false); | ||
|
@@ -42,18 +72,7 @@ export default function Header() { | |
<MobileNavigation navigation={siteConfig.navLinks} /> | ||
</div> | ||
<div className="flex flex-none items-center"> | ||
<Link href="/" aria-label="Home page"> | ||
<a className="flex items-center font-extrabold text-xl sm:text-2xl text-slate-900 dark:text-white"> | ||
<img src="/assets/images/logo.svg" alt="" className="w-9 h-9 mr-1 fill-white" /> | ||
{siteConfig.author} | ||
</a> | ||
</Link> | ||
{siteConfig.version | ||
&& ( | ||
<div className="mx-4 rounded-full border border-slate-500 py-1 px-3 text-xs text-slate-500"> | ||
{siteConfig.version} | ||
</div> | ||
)} | ||
<NavbarTitle /> | ||
<div className="hidden lg:flex ml-8 mr-6 sm:mr-8 md:mr-0"> | ||
{siteConfig.navLinks.map((item) => ( | ||
<Link key={item.href} href={item.href}> | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
surely
navbarTitle
is something like: