()
| 34 | ); |
| 35 | |
| 36 | const WithNavBar: FC = () => { |
| 37 | const { navigationItems } = useSiteNavigation(); |
| 38 | const { theme, setTheme } = useTheme(); |
| 39 | const { replace } = useRouter(); |
| 40 | const pathname = usePathname(); |
| 41 | const t = useTranslations(); |
| 42 | |
| 43 | const locale = useLocale(); |
| 44 | |
| 45 | const changeLanguage = (locale: SimpleLocaleConfig) => |
| 46 | replace(pathname!, { locale: locale.code }); |
| 47 | |
| 48 | return ( |
| 49 | <div> |
| 50 | <SkipToContentButton> |
| 51 | {t('components.common.skipToContent')} |
| 52 | </SkipToContentButton> |
| 53 | |
| 54 | <WithBanner section="index" /> |
| 55 | |
| 56 | <NavBar |
| 57 | navItems={navigationItems.map(([, { label, link, target }]) => ({ |
| 58 | link, |
| 59 | text: label, |
| 60 | target, |
| 61 | }))} |
| 62 | pathname={pathname} |
| 63 | as={Link} |
| 64 | Logo={WithNodejsLogo} |
| 65 | sidebarItemTogglerAriaLabel={t( |
| 66 | 'components.containers.navBar.controls.toggle' |
| 67 | )} |
| 68 | > |
| 69 | <WithSearch /> |
| 70 | |
| 71 | <ThemeToggle |
| 72 | onChange={setTheme} |
| 73 | currentTheme={(theme as Theme) ?? 'system'} |
| 74 | ariaLabel={t('components.header.buttons.theme')} |
| 75 | themeLabels={{ |
| 76 | system: t('components.header.buttons.themeSystem'), |
| 77 | light: t('components.header.buttons.themeLightMode'), |
| 78 | dark: t('components.header.buttons.themeDarkMode'), |
| 79 | }} |
| 80 | /> |
| 81 | |
| 82 | <LanguageDropdown |
| 83 | onChange={changeLanguage} |
| 84 | availableLanguages={availableLocales} |
| 85 | currentLanguage={locale} |
| 86 | ariaLabel={t('components.common.languageDropdown.label')} |
| 87 | /> |
| 88 | |
| 89 | <Link |
| 90 | href="https://github.com/nodejs/node" |
| 91 | aria-label="Node.js Github" |
| 92 | className={styles.ghIconWrapper} |
| 93 | > |
nothing calls this directly
no test coverage detected