@@ -22,15 +22,21 @@ type NavbarContextValue = { isOpen: boolean; open: () => void; close: () => void
2222export const [ NavbarContext , useNavbarContext , useUnsafeNavbarContext ] =
2323 createContextAndHook < NavbarContextValue > ( 'NavbarContext' ) ;
2424
25- export const NavbarContextProvider = ( props : React . PropsWithChildren < { } > ) => {
25+ export const NavbarContextProvider = ( props : React . PropsWithChildren < Record < never , never > > ) => {
2626 const [ isOpen , setIsOpen ] = React . useState ( false ) ;
2727 const open = React . useCallback ( ( ) => setIsOpen ( true ) , [ ] ) ;
2828 const close = React . useCallback ( ( ) => setIsOpen ( false ) , [ ] ) ;
2929 const value = React . useMemo ( ( ) => ( { value : { isOpen, open, close } } ) , [ isOpen ] ) ;
3030 return < NavbarContext . Provider value = { value } > { props . children } </ NavbarContext . Provider > ;
3131} ;
3232
33- export type NavbarRoute = { name : LocalizationKey ; id : string ; icon : React . ComponentType ; path : string } ;
33+ export type NavbarRoute = {
34+ name : LocalizationKey ;
35+ id : string ;
36+ icon : React . ComponentType ;
37+ path : string ;
38+ scroll : boolean ;
39+ } ;
3440type RouteId = NavbarRoute [ 'id' ] ;
3541type NavBarProps = {
3642 contentRef : React . RefObject < HTMLDivElement > ;
@@ -59,8 +65,10 @@ export const NavBar = (props: NavBarProps) => {
5965 } else {
6066 await navigate ( route . path ) ;
6167 }
62- const el = contentRef . current ?. querySelector ( getSectionId ( route . id ) ) ;
63- el ?. scrollIntoView ( { behavior : 'smooth' , block : 'start' } ) ;
68+ if ( route . scroll ) {
69+ const el = contentRef . current ?. querySelector ( getSectionId ( route . id ) ) ;
70+ el ?. scrollIntoView ( { behavior : 'smooth' , block : 'start' } ) ;
71+ }
6472 }
6573 } ;
6674
@@ -135,7 +143,7 @@ export const NavBar = (props: NavBarProps) => {
135143 ) ;
136144} ;
137145
138- const NavbarContainer = ( props : React . PropsWithChildren < { } > ) => {
146+ const NavbarContainer = ( props : React . PropsWithChildren < Record < never , never > > ) => {
139147 return (
140148 < Col
141149 elementDescriptor = { descriptors . navbar }
@@ -154,7 +162,7 @@ const NavbarContainer = (props: React.PropsWithChildren<{}>) => {
154162 ) ;
155163} ;
156164
157- const MobileNavbarContainer = ( props : React . PropsWithChildren < { } > ) => {
165+ const MobileNavbarContainer = ( props : React . PropsWithChildren < Record < never , never > > ) => {
158166 const navbarContext = useNavbarContext ( ) ;
159167 const { floating, isOpen, open, close } = usePopover ( { defaultOpen : false , autoUpdate : false } ) ;
160168
0 commit comments