/* Copyright 2026 Marimo. All rights reserved. */ import { useAtomValue } from "jotai"; import React from "react"; import { notebookOutline } from "@/core/cells/cells"; import type { OutlineItem } from "@/core/cells/outline"; import { cn } from "@/utils/cn"; import { findOutlineElements, scrollToOutlineItem, useActiveOutline, } from "./useActiveOutline"; export const FloatingOutline: React.FC = () => { const { items } = useAtomValue(notebookOutline); const { activeHeaderId, activeOccurrences } = useActiveOutline( findOutlineElements(items), ); const [isHovered, setIsHovered] = React.useState(false); // Hide if < 2 items // It's kinda useless to have an outline with only one item // and Notion does the same if (items.length < 2) { return null; } return (