Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions components/NavBar.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import ThemeToggle from '@node-core/ui-components/Common/ThemeToggle';
import NavBar from '@node-core/ui-components/Containers/NavBar';
import styles from '@node-core/ui-components/Containers/NavBar/index.module.css';
import GitHubIcon from '@node-core/ui-components/Icons/Social/GitHub';
Expand All @@ -10,16 +9,14 @@ import Logo from '#theme/Logo';

// TODO(avivkeller): Give these components proper exports
import SearchBox from '../node_modules/@doc-kit/generator-react/src/html/ui/components/SearchBox';
import { useTheme } from '../node_modules/@doc-kit/generator-react/src/html/ui/hooks/useTheme.mjs';
import ThemeToggle from '../node_modules/@doc-kit/generator-react/src/html/ui/components/ThemeToggle.jsx';

const versionBase = new URL(baseURL).pathname;

/**
* NavBar component that displays the headings, search, etc.
*/
export default ({ metadata }) => {
const [themePreference, setThemePreference] = useTheme();

return (
<NavBar
Logo={Logo}
Expand All @@ -28,11 +25,7 @@ export default ({ metadata }) => {
pathname={toPublicLink(metadata.path, versionBase)}
>
<SearchBox pathname={metadata.path} />
<ThemeToggle
onChange={setThemePreference}
currentTheme={themePreference}
ariaLabel="Toggle color theme"
/>
<ThemeToggle />
<a
href="https://github.com/webpack/webpack"
className={styles.ghIconWrapper}
Expand Down
5 changes: 4 additions & 1 deletion components/SideBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { sidebar } from '#theme/local/site';
import { version } from '#theme/config';
import { toPublicLink } from '../utils/helpers/urls.mjs';
import versions from '../versions.json' with { type: 'json' };
import withIsland from '../node_modules/@doc-kit/generator-react/src/html/ui/islands/withIsland.jsx';

/** @param {string} url */
const redirect = url => (window.location.href = url);
Expand Down Expand Up @@ -33,7 +34,7 @@ const versionItems = versions.map(version => ({
const currentVersion = isVersioned ? versionBase : undefined;

/** Docs sidebar, plus a webpack version picker on the versioned API docs. */
export default ({ metadata }) => (
const Sidebar = ({ metadata }) => (
<SideBar
pathname={toPublicLink(metadata.path, versionBase)}
groups={groupsFor(metadata.path)}
Expand All @@ -54,3 +55,5 @@ export default ({ metadata }) => (
)}
</SideBar>
);

export default withIsland(Sidebar, { name: 'SideBar', on: { idle: true } });
Loading