Open History to see the last commit
1import { useRef } from "react";
2
3import { ThemeToggle } from "@/components/theme/theme-toggle";
4
5import { DevGuideMenu } from "./dev-guide-menu";
6import { GuideDocument } from "./guide-document";
7import { TanStackDbMark } from "./tanstack-db-mark";
8import { useFollowActiveSection } from "./use-follow-active-section";
9import { useReadingPosition } from "./use-reading-position";
10
11/** The guide as a framed panel next to the app (desktop). */
12export function GuidePanel() {
13 const scrollRef = useRef<HTMLDivElement>(null);
14 useReadingPosition(scrollRef);
15 useFollowActiveSection(scrollRef);
16
17 return (
18 <div className="@container/guide flex h-full min-h-0 flex-col">
19 <div className="flex h-12 shrink-0 items-center gap-2 border-b px-3 @md/guide:px-4">
20 <TanStackDbMark />
21 <span className="hidden truncate text-sm font-semibold tracking-tight @md/guide:inline">
22 Try TanStack DB
23 </span>
24 <div className="ml-auto flex min-w-0 items-center gap-2">
25 {import.meta.env.DEV && <DevGuideMenu />}
26 <ThemeToggle />
27 </div>
28 </div>
29 <div ref={scrollRef} className="min-h-0 flex-1 overflow-y-auto overscroll-contain">
30 <GuideDocument />
31 </div>
32 </div>
33 );
34}