|
1 | | -import ThemeToggle from '@node-core/ui-components/Common/ThemeToggle'; |
2 | 1 | import NavBar from '@node-core/ui-components/Containers/NavBar'; |
3 | 2 | import styles from '@node-core/ui-components/Containers/NavBar/index.module.css'; |
4 | 3 | import GitHubIcon from '@node-core/ui-components/Icons/Social/GitHub'; |
5 | 4 |
|
6 | 5 | import SearchBox from './SearchBox'; |
7 | | -import { useTheme } from '../hooks/useTheme.mjs'; |
| 6 | +import ThemeToggle from './ThemeToggle.jsx'; |
8 | 7 |
|
9 | 8 | import { repository, showSearchBox, navigation } from '#theme/config'; |
10 | 9 | import Logo from '#theme/Logo'; |
11 | 10 |
|
12 | 11 | /** |
13 | 12 | * NavBar component that displays the headings, search, etc. |
14 | 13 | */ |
15 | | -export default ({ metadata }) => { |
16 | | - const [themePreference, setThemePreference] = useTheme(); |
17 | | - |
18 | | - return ( |
19 | | - <NavBar |
20 | | - Logo={Logo} |
21 | | - sidebarItemTogglerAriaLabel="Toggle navigation menu" |
22 | | - navItems={navigation.navbar ?? []} |
23 | | - // Drives the active-item highlight, and is dereferenced for every item |
24 | | - // whose link is site-absolute, so it must always be a string. |
25 | | - pathname={metadata.path} |
| 14 | +export default ({ metadata }) => ( |
| 15 | + <NavBar |
| 16 | + Logo={Logo} |
| 17 | + sidebarItemTogglerAriaLabel="Toggle navigation menu" |
| 18 | + navItems={navigation.navbar ?? []} |
| 19 | + // Drives the active-item highlight, and is dereferenced for every item |
| 20 | + // whose link is site-absolute, so it must always be a string. |
| 21 | + pathname={metadata.path} |
| 22 | + > |
| 23 | + {showSearchBox && <SearchBox pathname={metadata.path} />} |
| 24 | + <ThemeToggle /> |
| 25 | + <a |
| 26 | + href={`https://github.com/${repository}`} |
| 27 | + aria-label={`View ${repository} on GitHub`} |
| 28 | + className={styles.ghIconWrapper} |
26 | 29 | > |
27 | | - {showSearchBox && <SearchBox pathname={metadata.path} />} |
28 | | - <ThemeToggle |
29 | | - onChange={setThemePreference} |
30 | | - currentTheme={themePreference} |
31 | | - /> |
32 | | - <a |
33 | | - href={`https://github.com/${repository}`} |
34 | | - aria-label={`View ${repository} on GitHub`} |
35 | | - className={styles.ghIconWrapper} |
36 | | - > |
37 | | - <GitHubIcon /> |
38 | | - </a> |
39 | | - </NavBar> |
40 | | - ); |
41 | | -}; |
| 30 | + <GitHubIcon /> |
| 31 | + </a> |
| 32 | + </NavBar> |
| 33 | +); |
0 commit comments