@@ -3,6 +3,8 @@ import classNames from 'classnames';
33import { Menu , Transition } from '@headlessui/react' ;
44import { ChevronDownIcon , Bars3Icon as MenuIcon } from '@heroicons/react/24/solid' ;
55import type { SiteManifest , SiteNavItem } from 'myst-config' ;
6+ import type { GenericParent } from 'myst-common' ;
7+ import { MyST } from 'myst-to-react' ;
68import { ThemeButton } from './ThemeButton.js' ;
79import { Search } from './Search.js' ;
810import {
@@ -113,7 +115,15 @@ export function NavItems({ nav }: { nav?: SiteManifest['nav'] }) {
113115 ) ;
114116}
115117
116- export function TopNav ( { hideToc, hideSearch } : { hideToc ?: boolean ; hideSearch ?: boolean } ) {
118+ export function TopNav ( {
119+ hideToc,
120+ hideSearch,
121+ navbarEnd,
122+ } : {
123+ hideToc ?: boolean ;
124+ hideSearch ?: boolean ;
125+ navbarEnd ?: GenericParent ;
126+ } ) {
117127 const [ open , setOpen ] = useNavOpen ( ) ;
118128 const config = useSiteManifest ( ) ;
119129 const { title, nav, actions } = config ?? { } ;
@@ -152,8 +162,17 @@ export function TopNav({ hideToc, hideSearch }: { hideToc?: boolean; hideSearch?
152162 < div className = "flex items-center flex-grow w-auto" >
153163 < NavItems nav = { nav } />
154164 < div className = "flex-grow block" > </ div >
165+ { /* Search bar */ }
155166 { ! hideSearch && < Search /> }
156- < ThemeButton />
167+ { /* Light/Dark theme button */ }
168+ < ThemeButton className = "w-10 h-10 ml-3" />
169+ { /* Custom part at end of navbar. It is `hidden` up until xl size since it will be in the sidebar drawer up to that point */ }
170+ { navbarEnd && (
171+ < div className = "article myst-navbar-end hidden xl:flex items-center ml-3 [&>*]:m-0" >
172+ < MyST ast = { navbarEnd } />
173+ </ div >
174+ ) }
175+ { /* Mobile pop-up for page actions */ }
157176 < div className = "block sm:hidden" >
158177 < ActionMenu actions = { actions } />
159178 </ div >
0 commit comments