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

feat: optionally allow the primary sections of the project sidebar be collapsible #258

Merged
merged 7 commits into from
Aug 17, 2024

Conversation

SeanCassiere
Copy link
Member

@SeanCassiere SeanCassiere commented Jul 31, 2024

Description

From the Table channel: https://discord.com/channels/719702312431386674/1266888851260182548

This change makes the sections in the sidebar of the documentation portion of the website collapsible, by project-specific configuration in their docs/config.json file.

Configuration

If you want to make a section collapsible, you'll need to add collapsible: true to the overarching section in the individual Project's docs/config.json. Furthermore, you can optionally choose to have the sidebar section be in its 'collapsed' by default, using the defaultCollapsed property by setting it to true.

Note

If the collapsible property resolves to false | undefined, then any value set on the defaultCollapsed property will be disregarded and have no effect on the rendered content.

E.g.

{
    "$schema": "https://raw.githubusercontent.com/TanStack/tanstack.com/main/tanstack-docs-config.schema.json",
    "docSearch": {},
    "sections": [
        {
            "label": "Getting Started",
            "children": [],
            "frameworks": []
        },
        {
            "label": "Guide",
            "children": [],
            "collapsible": true, // <-- makes the entire section collapsible
            "defaultCollapsed": false // <-- controls whether the section is 'closed' on render, by default it is false
            "frameworks": []
        }
    ]
}

Screenshots

Before:

image

After:

image

Copy link

vercel bot commented Jul 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tanstack-com ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 17, 2024 10:23am

@KevinVandy
Copy link
Member

I think this great. Maybe add a defaultCollapsed boolean too?

@SeanCassiere SeanCassiere marked this pull request as ready for review August 17, 2024 10:22
@SeanCassiere SeanCassiere changed the title feat: allow the sidebar sections to be collapsible feat: optionally allow the primary sections of the project sidebar be collapsible Aug 17, 2024
@SeanCassiere
Copy link
Member Author

SeanCassiere commented Aug 17, 2024

@KevinVandy changes have been made 🎉

Edit: I'd give it a test locally to make sure this is the kind of UX you are looking for Table.

@SeanCassiere SeanCassiere merged commit e14f12e into main Aug 17, 2024
4 checks passed
@SeanCassiere SeanCassiere deleted the feat/collapsible-sidebar-sections branch August 17, 2024 13:36
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.

2 participants