diff --git a/README.md b/README.md index b287380c7..ae2fcad23 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,14 @@ - [ ] Code block syntax highlighting - Theme - [ ] Toggler +- Page feedback +- Edit on GitHub +- Header links ## Differences -- Full-width mode: +- Changed: Full-width mode: - When off, layout is centered - It now detects based on the page +- New: Scroll to top button in page aside +- New: Proper RTL support \ No newline at end of file diff --git a/src/components/PageAside/PageAside.tsx b/src/components/PageAside/PageAside.tsx new file mode 100644 index 000000000..8bec0459c --- /dev/null +++ b/src/components/PageAside/PageAside.tsx @@ -0,0 +1,49 @@ +import { getDocumentSections } from "@/lib/document"; +import { tcls } from "@/lib/tailwind"; +import { RevisionPageDocument } from "@gitbook/api"; +import React from "react"; +import { ScrollSectionsList } from "./ScrollSectionsList"; + +/** + * Aside listing the headings in the document. + */ +export function PageAside(props: { + page: RevisionPageDocument; + document: any; +}) { + const { document } = props; + const sections = getDocumentSections(document); + + return ( + + ) +} \ No newline at end of file diff --git a/src/components/PageAside/ScrollSectionsList.tsx b/src/components/PageAside/ScrollSectionsList.tsx new file mode 100644 index 000000000..fa216bb36 --- /dev/null +++ b/src/components/PageAside/ScrollSectionsList.tsx @@ -0,0 +1,39 @@ +'use client'; + +import { DocumentSection } from "@/lib/document"; +import { tcls } from "@/lib/tailwind"; +import Link from "next/link"; +import React from "react"; +import { IconChevronRight } from "@/components/icons/IconChevronRight"; + +export function ScrollSectionsList(props: { + sections: DocumentSection[]; +}) { + const { sections } = props; + const [activeId, setActiveId] = React.useState(null); + + React.useEffect(() => { + // + }, []); + + return ( + + ) +} \ No newline at end of file diff --git a/src/components/PageAside/index.ts b/src/components/PageAside/index.ts new file mode 100644 index 000000000..9ce564872 --- /dev/null +++ b/src/components/PageAside/index.ts @@ -0,0 +1 @@ +export * from './PageAside'; diff --git a/src/components/SpaceContent/SpaceContent.tsx b/src/components/SpaceContent/SpaceContent.tsx index 1d190670f..3e11b16f2 100644 --- a/src/components/SpaceContent/SpaceContent.tsx +++ b/src/components/SpaceContent/SpaceContent.tsx @@ -9,6 +9,7 @@ import { SearchModal } from '@/components/Search'; import { Footer } from '@/components/Footer'; import { hasFullWidthBlock } from '@/lib/document'; import { CONTAINER_MAX_WIDTH_NORMAL, CONTAINER_PADDING } from '@/components/layout'; +import { PageAside } from '../PageAside'; /** * Render the entire content of the space (header, table of contents, footer, and page content). @@ -36,6 +37,7 @@ export function SpaceContent(props: { > +