Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions app/components/AsciidocBlocks/Document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,15 @@
*
* Copyright Oxide Computer Company
*/
import { useDelegatedReactRouterLinks } from '@oxide/design-system/components/dist'
import { Content, type DocumentBlock } from '@oxide/react-asciidoc'
import { useRef } from 'react'

const CustomDocument = ({ document }: { document: DocumentBlock }) => {
let ref = useRef<HTMLDivElement>(null)
useDelegatedReactRouterLinks(ref, document.title)

return (
<div
id="content"
className="asciidoc-body max-w-full flex-shrink overflow-hidden 800:overflow-visible 800:pr-10 1200:w-[calc(100%-var(--toc-width))] 1200:pr-16 print:p-0"
ref={ref}
>
<Content blocks={document.blocks} />
</div>
)
}
const CustomDocument = ({ document }: { document: DocumentBlock }) => (
<div
id="content"
className="asciidoc-body max-w-full flex-shrink overflow-hidden 800:overflow-visible 800:pr-10 1200:w-[calc(100%-var(--toc-width))] 1200:pr-16 print:p-0"
>
<Content blocks={document.blocks} />
</div>
)

export { CustomDocument }
11 changes: 8 additions & 3 deletions app/routes/rfd.$slug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
DesktopOutline,
SmallScreenOutline,
useActiveSectionTracking,
useDelegatedReactRouterLinks,
useIntersectionObserver,
} from '@oxide/design-system/components/dist'
import { Asciidoc, type DocumentBlock, type DocumentSection } from '@oxide/react-asciidoc'
Expand All @@ -18,7 +19,7 @@ import {
type LoaderFunctionArgs,
type MetaFunction,
} from '@remix-run/node'
import { Await, useLoaderData, useLocation } from '@remix-run/react'
import { Await, useLoaderData, useLocation, useNavigate } from '@remix-run/react'
import cn from 'classnames'
import dayjs from 'dayjs'
import {
Expand Down Expand Up @@ -170,8 +171,12 @@ export default function Rfd() {
setSections(headings)
}, [content.sections, setSections])

const navigate = useNavigate()
const containerRef = useRef<HTMLDivElement>(null)
useDelegatedReactRouterLinks(navigate, containerRef, title)

return (
<>
<div ref={containerRef}>
{/* key makes the search dialog close on selection */}
<Header currentRfd={rfd as RfdItem} key={pathname + hash} />
<main className="relative mt-12 800:mt-16 print:mt-0">
Expand Down Expand Up @@ -328,7 +333,7 @@ export default function Rfd() {
key={pathname}
/>
</div>
</>
</div>
)
}

Expand Down
9 changes: 4 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@asciidoctor/core": "^3.0.4",
"@floating-ui/react": "^0.17.0",
"@meilisearch/instant-meilisearch": "^0.8.2",
"@oxide/design-system": "^1.8.4",
"@oxide/design-system": "^3.0.0",
"@oxide/react-asciidoc": "^1.0.3",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-dropdown-menu": "^2.0.4",
Expand Down
Loading