Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fixed sidebar issue #83

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
15 changes: 12 additions & 3 deletions app/components/Docs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export function Docs({
v2?: boolean
}) {
const matches = useMatches()
console.log(matches)
const lastMatch = last(matches)

const detailsRef = React.useRef<HTMLElement>(null!)
Expand All @@ -70,6 +69,15 @@ export function Docs({
const index = flatMenu.findIndex((d) => d.to === relativePathname)
const prevItem = flatMenu[index - 1]
const nextItem = flatMenu[index + 1]

document.body.style.overflow = 'visible'
const toggleBodyOverflow = () => {
if (detailsRef.current?.hasAttribute('open')) {
document.body.style.overflow = 'hidden'
} else {
document.body.style.overflow = 'visible'
}
}

const menuItems = config.menu.map((group, i) => {
return (
Expand Down Expand Up @@ -147,6 +155,7 @@ export function Docs({
ref={detailsRef as any}
id="docs-details"
className="border-b border-gray-500 border-opacity-20"
onToggle={toggleBodyOverflow}
>
<summary className="p-4 flex gap-2 items-center justify-between">
<div className="flex gap-2 items-center text-xl md:text-2xl">
Expand All @@ -157,9 +166,9 @@ export function Docs({
<Search {...config.docSearch} />
</summary>
<div
className="flex flex-col gap-4 p-4 whitespace-nowrap h-[0vh] overflow-y-auto
className="flex flex-col gap-4 p-4 whitespace-nowrap
border-t border-gray-500 border-opacity-20 bg-gray-100 text-lg
dark:bg-gray-900"
dark:bg-gray-900 h-[100vh] overflow-y-auto pb-24"
>
<div className="flex gap-4">
{framework?.selected ? (
Expand Down
4 changes: 0 additions & 4 deletions app/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@
display: none;
}

#docs-details[open] > summary + * {
height: 80vh;
}

.anchor-heading {
text-decoration: none !important;
}
Expand Down