docs icon indicating copy to clipboard operation
docs copied to clipboard

feat(layouts): add resizable side panels with localStorage persistence

Open Rudra2637 opened this issue 6 months ago • 11 comments

Description

This PR implements the resizable side panels feature for Layer5 Docs, allowing users to customize the width of the left sidebar and right table of contents (TOC) panel.

Related Issue

Fixes #1039

Changes Made

  • JavaScript (assets/js/resizable-panels.js): Drag-to-resize functionality with localStorage persistence and reset button
  • Styling (assets/scss/_resizable-panels.scss): Visual feedback for resize handles, responsive hiding on mobile/print
  • Integration: Updated stylesheet imports and created scripts partial for proper loading

Features Implemented

✅ Users can drag to adjust panel widths (left sidebar and right TOC) ✅ Preferences are saved in localStorage and persist across page visits ✅ Reset button available to restore default panel widths ✅ Responsive design: resize functionality only on desktop (XL screens) ✅ Constrained min/max widths to prevent layout breaking

Testing

  • Tested resize functionality (drag handles work smoothly)
  • Verified localStorage persistence (widths retained across page reloads)
  • Tested reset button (restores defaults)
  • Verified mobile/tablet responsiveness (handles hidden on smaller screens)
  • Verified print styles (handles hidden)

Notes for Reviewers

Per the acceptance criteria, a matching issue should be created for Meshery Docs to receive the same enhancement.

Signed Commits

  • [x] Yes, I signed my commits.

Contributing Conventions: PR includes descriptive title with [layouts] component, changes tested, and commits are signed.

Rudra2637 avatar May 14 '26 19:05 Rudra2637

PR Preview Action v1.6.3
Preview removed because the pull request was closed.
2026-06-13 18:19 UTC

github-actions[bot] avatar May 14 '26 20:05 github-actions[bot]

@Rudra2637 Thank you for your contribution! Let's discuss this during the website call tomorrow at 5:30 PM IST | 7 AM CST Add it as an agenda item to the meeting minutes, if you would :slightly_smiling_face:

Bhumikagarggg avatar May 17 '26 16:05 Bhumikagarggg

@banana-three-join, how are we doing here?

leecalcote avatar May 19 '26 22:05 leecalcote

REPEAT:

Acceptance Tests We're using the same framework (Hugo) and same theme across our site properties with much intentionality: reuse, consistent UX, lower cost of sustaining, and so on. When either Meshery Docs or Layer5 Docs receives an enhancement or bug fix in the layout/framework/shortcode/partial, etc... both should benefit. So, open an issue to enhance Meshery Docs when this feature is delivered.

alexquincy avatar May 19 '26 22:05 alexquincy

Thanks for the clarification. I’ll revert back to the previous implementation with the side panel width adjustments and update the PR accordingly. Once that’s done, will let you know.

Rudra2637 avatar May 21 '26 10:05 Rudra2637

Ok, I will look into the suggested changes and re request review once i am done adjusting the pr as per the suggestions

Rudra2637 avatar May 25 '26 04:05 Rudra2637

/gemini review

banana-three-join avatar May 26 '26 21:05 banana-three-join

@Rudra2637 Please review the recommendations and resolved them. The most recent recommendations (Both mine's a Gemini's) don't point out any major bugs so after the feedback has been addressed, and it has been stated how it has been addressed, a video proof should be more than enough to merge the pr!

banana-three-join avatar May 26 '26 22:05 banana-three-join

Ok i will look into your suggestions as well as gemini and create video

Rudra2637 avatar May 27 '26 13:05 Rudra2637

The latest recommendations have been addressed. The resource-loading code now uses an array and loop instead of adding each asset individually, the resizable-panels logic has already been refactored to avoid unnecessary class usage, and the width normalization now uses the defined per-item limits instead of a shared magic number.

https://github.com/user-attachments/assets/c57f5d38-2282-4a2a-b04c-103b9cf25053

Rudra2637 avatar May 29 '26 14:05 Rudra2637

Hey @banana-three-join have exams would be looking to this as soon as i get some time.

Rudra2637 avatar Jun 02 '26 05:06 Rudra2637

@Rudra2637 Any updates in regards of your availability to conclude the PR?

banana-three-join avatar Jun 09 '26 16:06 banana-three-join

sorry for the delay, will be updating the pr tomorrow or day after tomorrow

Rudra2637 avatar Jun 09 '26 16:06 Rudra2637

@Rudra2637 Also, you're going to have conflicts because you're currently using the outdated usage of .Site.Lang in Hugo which is now deprecated and was correctly replaced upstream so look into also removing it's usage in favor for the new convention.

banana-three-join avatar Jun 11 '26 17:06 banana-three-join

Thanks for the feedback.

Dynamic event listeners: The pointermove, pointerup, and pointercancel listeners are now attached per drag gesture inside startResize() using an AbortController. When the resize gesture ends (pointerup or pointercancel), controller.abort() removes all associated listeners automatically.

Single manager / multiple sidebars: There is only one .row.flex-xl-nowrap container rendered per page (as defined in baseof.html), so initializing a single resize manager via querySelector() is intentional.

Please let me know if I've misunderstood any part of the earlier feedback or if there's another concern I should address.

Rudra2637 avatar Jun 13 '26 14:06 Rudra2637

@Rudra2637 I apologize but due to the lack of communication and the time that it took to take care of this PR, it was assigned to me so I could finish it which has been done over in https://github.com/layer5io/docs/pull/1098 so this PR can be closed.

banana-three-join avatar Jun 13 '26 17:06 banana-three-join

Hey @banana-three-join no problem it was obvious i took so much of time

Rudra2637 avatar Jun 13 '26 17:06 Rudra2637