diff --git a/reader/src/App.jsx b/reader/src/App.jsx index 1c67b4e..5a9d982 100644 --- a/reader/src/App.jsx +++ b/reader/src/App.jsx @@ -1,5 +1,11 @@ import { useLayoutEffect, useState, useRef, useEffect } from "react"; -import { ArrowBackIcon, ArrowForwardIcon, MenuBookIcon, MyLocationIcon } from "./icons/Icons"; +import { + ArrowBackIcon, + ArrowForwardIcon, + MenuBookIcon, + MyLocationIcon, + TitleIcon, +} from "./icons/Icons"; import structureOriginal from "./structure.json"; @@ -67,12 +73,14 @@ export function TopicListView({ selectedIndex, onChange }) { ); } -function Layout({ children, title }) { +function Layout({ children, title, displayTitle }) { return (
-
- {title} -
+ {displayTitle && ( +
+ {title} +
+ )} {children}
); @@ -82,6 +90,7 @@ export default function App() { const [isMenuOpen, setIsMenuOpen] = useState(true); const [selectedIndex, setSelectedIndex] = useState(null); const [versions, setVersions] = useState(Array.from({ length: structure.length }, () => 0)); + const [displayTitle, setDisplayTitle] = useState(true); function handleChange(i) { setSelectedIndex(i); @@ -90,25 +99,38 @@ export default function App() { if (isMenuOpen) { return ( - + ); } return ( - +
- +
+ + +
{structure[selectedIndex].files.length > 1 && (
{structure[selectedIndex].files.map((file, vIndex) => ( @@ -139,7 +161,7 @@ export default function App() { {selectedIndex === 0 ? (
) : ( -
setSelectedIndex((prev) => prev - 1)} className="border-r border-blue-200 w-1/2 flex-1 px-4 py-2 hover:bg-blue-200 cursor-pointer flex align-center justify-start" > @@ -147,12 +169,12 @@ export default function App() { {selectedIndex}: {structure[selectedIndex - 1].title} -
+ )} {selectedIndex === structure.length - 1 ? (
) : ( -
setSelectedIndex((prev) => prev + 1)} className="flex-1 px-4 py-2 hover:bg-blue-200 w-1/2 cursor-pointer flex align-center justify-end" > @@ -160,7 +182,7 @@ export default function App() { {selectedIndex + 2}: {structure[selectedIndex + 1].title} -
+ )}
diff --git a/reader/src/icons/Icons.jsx b/reader/src/icons/Icons.jsx index e88cd18..dc7f91d 100644 --- a/reader/src/icons/Icons.jsx +++ b/reader/src/icons/Icons.jsx @@ -14,6 +14,22 @@ export function MyLocationIcon({ className }) { ); } +export function TitleIcon({ className }) { + return ( + + + + + ); +} + export function MenuBookIcon({ className }) { return (