-
Notifications
You must be signed in to change notification settings - Fork 16
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
📏 Allow full-length TOC when sidebar is useable #441
Conversation
🦋 Changeset detectedLatest commit: d7adea6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This PR bumps each package as a |
Note: I want to generalise the TOC sidebar into a primary sidebar, but that's more work. |
themes/book/app/routes/$.tsx
Outdated
return ( | ||
<UiStateProvider> | ||
<ArticlePageAndNavigationInternal | ||
children={children} | ||
hide_toc={hide_toc} | ||
projectSlug={projectSlug} | ||
inset={inset} | ||
/> | ||
</UiStateProvider> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a nicer way to access the result of a useContext
inside the component tree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mean that you want to access the UIStateProvider context within this same function, rather than creating a new wrapper component? you can do something like this but it's not nicer...
return (
<UiStateProvider>
{(() => {
const uiState = useUiState();
return (
<ArticlePageAndNavigationInternal
children={children}
hide_toc={hide_toc}
projectSlug={projectSlug}
inset={inset}
/>);
})
}
</UiStateProvider>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yep, that's one way!
Where is the footer coming from in the UI? |
Oh, haha, I appended it to the dom during testing. It only matters presently for the mystmd website. |
This is now done! |
208613d
to
916620d
Compare
@stevejpurves I rebased this on main, would you be able to confirm it still behaves as expected on mystmd.org? |
4e8f9b0
to
d7adea6
Compare
rebased again, review in progress locally... having to update mystmd.org on some orthogonal changes that have happened whilst this PR has been alive... |
all looks good, sorry for the lengthy review cycle! |
Presently, the TOC is always trimmed to the page length, in full-width OR narrow displays:
This PR tweaks the computation to detect when the "wide" media query is true/false:
I think there might be some overflow problems, but I don't think they're caused by this PR.