feat(oc-docs): resizable, collapsible docs and playground sidebars - #139
Merged
bijin-bruno merged 8 commits intoJul 23, 2026
Merged
Conversation
Both sidebars can be drag-resized from their right edge (200-480px, sessionStorage-persisted per tab, restored on reload). Dragging past the min collapses the sidebar VS Code-style; dragging back within the same held gesture re-expands it, with the resize cursor held throughout. Adds useResizableSidebar (sessionStorage width + collapse threshold) and extends useDockResize with a leading edge and collapse/expand handoff on window listeners so the drag survives the handle unmounting.
Draws a 2px border2 line on the resize handle while hovered or actively dragging (kept lit for the whole held gesture via data-dragging, so it does not flicker when the pointer outruns the handle at max width). No transition, so the highlight tracks fast hover changes during a resize.
Export areaFor from useStorage and call it from useResizableSidebar instead of a duplicated SSR guard. Memoise the initial stored-width read so it does not re-run on every render (once per pointer move during a drag). Use the --z-sidebar token for the playground resizer z-index to match AppShell.
…rame Route the drag width update through requestAnimationFrame (cancel-prior) so multiple pointermoves in a frame trigger at most one setSize, instead of a re-render per dispatched move. Collapse/expand stay synchronous so their timing is unchanged; the pending frame is cancelled on unmount.
…ble-sidebars # Conflicts: # packages/oc-docs/src/components/Playground/PlaygroundBody/PlaygroundBody.tsx
Cover both sidebars: drag to widen, clamp at max, persist width across reload (sessionStorage), overshoot-to-collapse with reopen, and re-expand within the same held drag. Adds resize drag helpers to the sidebar and playground page-object components.
Move the shared grab / movePointerToX / releasePointer trio (and the drag-y state) onto BaseComponent so the sidebar and playground page objects no longer duplicate them; each keeps only its handle-specific grab wrapper.
sundram-bruno
marked this pull request as ready for review
July 22, 2026 13:20
Address PR review: express the resize handle width, offset and hover line in rem instead of px, matching the repo's rem-based sizing.
sachin-bruno
approved these changes
Jul 22, 2026
bijin-bruno
approved these changes
Jul 23, 2026
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.
JIRA : BRU-3753
Summary
Make both sidebars drag-resizable and collapsible: the docs sidebar (AppShell) and the playground sidebar (PlaygroundBody).
Behaviour
--oc-border-border2) on hover, and stays highlighted for the whole drag (even when the pointer outruns the handle at max width).Implementation
useResizableSidebarhook: sessionStorage-backed width (read once viaareaFor, persisted only when the drag settles) plus a collapse threshold.useDockResizehook: added aleadingedge (left sidebars grow rightward),onCollapse/onExpandhandoff, drag listeners onwindowso the gesture survives the handle unmounting on collapse, a body cursor/selection lock, andrequestAnimationFrame-coalesced width writes (at most onesetSizeper frame). Docks keep their previous behaviour via thetrailingdefault.--sidebar-widthon.appshell-body; the playground scopes its own inline--sidebar-width, so the two stay independent. Collapse reuses the existing affordances to reopen (docs expand chevron, playground sidebar toggle).