Skip to content

Conversation

@SeanCassiere
Copy link
Member

@SeanCassiere SeanCassiere commented Mar 3, 2025

Currently, on desktop, on the right side of the page, we have a persistent table of contents section that lists all the available headings within the markdown document. This section/component was hidden on mobile as its persistent nature would work on mobile.

This change, adds a mobile-optimized version of the above component, without the sticky/persistent nature.

Before:

image

After:

image

With the section opened:

image

Also, looks surprisingly good in dark-mode as well:

image

@netlify
Copy link

netlify bot commented Mar 3, 2025

Deploy Preview for tanstack ready!

Name Link
🔨 Latest commit a494940
🔍 Latest deploy log https://app.netlify.com/sites/tanstack/deploys/67c5440b7ca5b10008f15ad4
😎 Deploy Preview https://deploy-preview-366--tanstack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 53 (🟢 up 1 from production)
Accessibility: 95 (no change from production)
Best Practices: 83 (🔴 down 9 from production)
SEO: 77 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

<div
{...props}
className={twMerge(
'w-full max-w-full space-y-2 md:space-y-6 lg:space-y-8 p-2 md:p-6 lg:p-8',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This spacing was only being used to add margin to the "Back" button on the blog page. So it was moved over to the button itself as the space- utils would otherwise have been applied to the<TocMobile> component even if it was visually hidden on the screen.

I opted not to use a React (useMediaQuery) hook in-favor of relying on CSS.

@SeanCassiere SeanCassiere marked this pull request as ready for review March 3, 2025 05:49
@tannerlinsley tannerlinsley merged commit 703d8a0 into main Mar 3, 2025
6 checks passed
@tannerlinsley tannerlinsley deleted the mobile-heading-selection branch March 3, 2025 06:40
LeCarbonator pushed a commit to LeCarbonator/tanstack.com that referenced this pull request Jan 11, 2026
* refactor: move `space-y-` margin utils to the single caller's source

* feat: add mobile table of contents

* chore: more accessible and lessen the indentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants