Add resizable sidebar and improve frontmatter tab toggles - #59
Merged
Conversation
Add drag-to-resize sidebar with pointer capture, localStorage persistence, and 200-500px width range. Restructure sidebar into outer positioning container and inner scrollable area so the drag handle stays fixed regardless of scroll position.
Use scrollbar-gutter: stable to reserve scrollbar space during loading, and initialize sidebar width from localStorage synchronously to prevent a flash from default width on navigation.
…stent styling; move copy/download buttons
Signed-off-by: Chris Thomas <chris.c.thomas@icloud.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



This pull request introduces several enhancements and UI improvements to the content viewer and sidebar components, as well as better handling and display of raw YAML frontmatter in content pages. The main changes include adding a frontmatter toggle with raw YAML view, moving copy/download buttons to the page header, and making the sidebar resizable with persistent width.
Frontmatter and Content Viewing Improvements:
FrontmatterPanel.astrothat allows users to switch between a raw YAML view and a rendered metadata view, including a new styled toolbar and keyboard-accessible tab triggers. The raw YAML is now displayed in a preformatted block, and the toggle logic is handled via a small script. [1] [2] [3] [4] [5] [6]frontmatter.tsto extract and return the raw YAML block, which is then passed through to the frontmatter panel and content viewer components. TheContentViewerPropstype and page logic are updated accordingly. [1] [2] apps/astro/src/pages/ecfr/[...slug].astroR48, apps/astro/src/pages/ecfr/[...slug].astroR150, apps/astro/src/pages/usc/[...slug].astroR49, apps/astro/src/pages/usc/[...slug].astroR111)Copy/Download Button Placement:
ContentViewercomponent and into the page header, next to the title, for better discoverability and to clarify that they refer to the entire file (frontmatter + body). The buttons are now rendered in the main content pages (ecfr/[...slug].astroandusc/[...slug].astro). (apps/astro/src/pages/ecfr/[...slug].astroL183-R207, apps/astro/src/pages/usc/[...slug].astroL144-R168)ContentViewertoolbar, and updated its description and props accordingly. [1] [2]Sidebar Usability:
File Content Handling:
These changes collectively improve the user experience for viewing, copying, and downloading content and metadata, as well as provide a more flexible and accessible sidebar.