// Copyright (c) Meta Platforms, Inc. and affiliates. 'use client'; import {useRef, useState} from 'react'; import {Button} from '@astryxdesign/core/Button'; import {HStack, VStack} from '@astryxdesign/core/Layout'; import {Markdown} from '@astryxdesign/core/Markdown'; import {Outline, useOutlineFromMarkdown} from '@astryxdesign/core/Outline'; import {ScrollableArea} from '@astryxdesign/core/ScrollableArea'; const ARTICLE = `## Before you start Check that your project builds on the current release. Commit your work, so that you can compare the result of the upgrade. ## Run the upgrade Update the packages, then rebuild the project. The upgrade changes no source files. ### Update the packages Install the new version of every package at the same time. Mixed versions fail the build. ### Rebuild the project Delete the build output first. A stale cache can hide a real error. ## Check the result Open the pages that you use most, and compare them with the earlier build. `; const NEW_SECTION = ` ## New section The button added this heading to the Markdown string. `; export default function UseOutlineFromMarkdownHookUsage() { const [markdown, setMarkdown] = useState(ARTICLE); const items = useOutlineFromMarkdown(markdown); const articleRef = useRef(null); return ( {markdown} {/* A non-zero offset moves only the article. With 0, a click also moves the page around the article. */}