diff --git a/src/app/[locale]/page.tsx b/src/app/[locale]/page.tsx
index 99fe8eae..e202d19f 100644
--- a/src/app/[locale]/page.tsx
+++ b/src/app/[locale]/page.tsx
@@ -5,9 +5,9 @@ export default async function HomePage() {
return (
-
+
-
+
Library
diff --git a/src/app/[locale]/reader/_components/navbar/index.tsx b/src/app/[locale]/reader/_components/navbar/index.tsx
index e7f465da..1899d738 100644
--- a/src/app/[locale]/reader/_components/navbar/index.tsx
+++ b/src/app/[locale]/reader/_components/navbar/index.tsx
@@ -4,21 +4,29 @@ import { Logo } from "@/components/Icons";
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import { Link } from "@/navigation";
-import { Bars3Icon } from "@heroicons/react/20/solid";
+import {
+ Bars3Icon,
+ MagnifyingGlassIcon,
+ XMarkIcon,
+} from "@heroicons/react/20/solid";
import { LanguageIcon } from "@heroicons/react/24/outline";
-import { useEffect } from "react";
+import { useEffect, useRef, useState } from "react";
import { ThemeToggle } from "./theme-toggle";
import SearchBar from "./search";
import { useNavbarStore } from "@/stores/navbar";
interface ReaderNavbarProps {
contentContainerRef: React.RefObject
;
+ sidebarContent: React.ReactNode;
}
export default function ReaderNavbar({
contentContainerRef,
+ sidebarContent,
}: ReaderNavbarProps) {
const { showNavbar, setShowNavbar } = useNavbarStore();
+ const [isMenuOpen, setIsMenuOpen] = useState(false);
+ const [isSearchOpen, setIsSearchOpen] = useState(false);
useEffect(() => {
let oldValue = 0;
@@ -47,44 +55,77 @@ export default function ReaderNavbar({
}, []);
return (
-
+
+
+ {isMenuOpen && (
+
+ {sidebarContent}
+
)}
- >
-
-
-
-
-
-
-
-
-
-
-
- {/* Mobile menu button */}
-
-
-
-
-
-
-
-
-
+
+ {isSearchOpen && (
+
+
+
+ )}
+ >
);
}
diff --git a/src/app/[locale]/reader/_components/navbar/search.tsx b/src/app/[locale]/reader/_components/navbar/search.tsx
index 398c1980..8f8e8e33 100644
--- a/src/app/[locale]/reader/_components/navbar/search.tsx
+++ b/src/app/[locale]/reader/_components/navbar/search.tsx
@@ -21,7 +21,7 @@ import { useBoolean, useDebounceValue } from "usehooks-ts";
* - sidebar snapping
*/
-export default function SearchBar() {
+export default function SearchBar({ autoFocus }: { autoFocus?: boolean }) {
const [value, setValue] = useState("");
const focusedState = useBoolean(false);
const [debouncedValue] = useDebounceValue(value, 300);
@@ -84,6 +84,7 @@ export default function SearchBar() {
value={value}
onValueChange={setValue}
ref={inputRef}
+ autoFocus={autoFocus}
onFocus={focusedState.setTrue}
onBlur={focusedState.setFalse}
isLoading={isPending}
diff --git a/src/app/[locale]/reader/_components/sidebar/sidebar-resizer.tsx b/src/app/[locale]/reader/_components/sidebar/sidebar-resizer.tsx
index 29156536..9394a867 100644
--- a/src/app/[locale]/reader/_components/sidebar/sidebar-resizer.tsx
+++ b/src/app/[locale]/reader/_components/sidebar/sidebar-resizer.tsx
@@ -48,7 +48,10 @@ export default function SidebarResizer({
return (
<>
-
+