Skip to content

Export PageLayout resizable functionality#8160

Merged
TylerJDev merged 14 commits into
mainfrom
tylerjdev/export-pagelayout-resizable
Jul 16, 2026
Merged

Export PageLayout resizable functionality#8160
TylerJDev merged 14 commits into
mainfrom
tylerjdev/export-pagelayout-resizable

Conversation

@TylerJDev

@TylerJDev TylerJDev commented Jul 14, 2026

Copy link
Copy Markdown
Member

Part of https://github.com/github/core-ux/issues/2973, prerequisite to https://github.com/github/github-ui/pull/26724

Places PageLayout drag functionality into its own component: packages/react/src/PageLayout/DragHandle.tsx, to allow usage outside of PageLayout.

The changes here aim to extend the modularity of PageLayout by breaking up the drag functionality. We keep the functionality exactly the same within PageLayout, but export the pieces that can be used in other components, (see https://github.com/github/core-ux/issues/2973 for more context).

PR changes:

  • packages/react/src/PageLayout/usePaneWidth.ts
    • We make the contentWrapperRef prop optional so that other components can pass or omit a ref.
    • Changes in this file are mostly additive.
  • packages/react/src/PageLayout/PageLayout.tsx
    • We move DragHandle into its own component (packages/react/src/PageLayout/DragHandle.tsx)
    • We move some imports to DragHandle
  • packages/react/src/PageLayout/DragHandle.tsx
    • Near 1:1 with what already existed within PageLayout.
    • Modified/added props, such as dragTargetRef.
    • Behavior remains the same.

Changelog

Changed

  • Moves DragHandle outside of PageLayout.tsx, into its own component.
  • Adjusted some props to handle usage of DragHandle / usePaneWidth outside of PageLayout context.

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

The behavior should be exactly the same as it is today in production. In addition, I've added a story (on dev) that shows what usage could look like when DragHandle is used outside of PageLayout.

Questions

  • Could we simplify the usage any more than what we have currently?
  • Do we need to add new additions to our docs?

@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b07d552

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@TylerJDev TylerJDev added the Canary Release Apply this label when you want CI to create a canary release of the current PR label Jul 14, 2026
@github-actions github-actions Bot added staff Author is a staff member integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Jul 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. If this doesn't work, you can also use the original workflow here. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

To publish a canary release for integration testing, apply the Canary Release label to this PR.

@primer

primer Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

🤖 Formatting issues have been automatically fixed and committed to this PR.

Comment on lines +52 to +65
export const DragHandle = memo<DragHandleProps>(function DragHandle({
handleRef,
onDragStart,
onDrag,
onDragEnd,
onDoubleClick,
'aria-valuemin': ariaValueMin,
'aria-valuemax': ariaValueMax,
'aria-valuenow': ariaValueNow,
dragTargetRef,
contentWrapperRef,
formatValueText = defaultFormatValueText,
'data-component': dataComponent = 'PageLayout.DragHandle',
}) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

A near 1:1 with what we already had in PageLayout, just moved to its own file so that it can be exported.

There are a few changes, such as props to improve the portability. Behavior and functionality should remain the same within PageLayout.

'aria-valuemin': ariaValueMin,
'aria-valuemax': ariaValueMax,
'aria-valuenow': ariaValueNow,
dragTargetRef,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is different compared to how it was in PageLayout. Before we directly used paneRef via context, but now we pass paneRef via this prop in PageLayout.

This is to support usage outside of PageLayout, where the target ref differs from the one within the PageLayout component.

)
})

type DragHandleProps = {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Drag handler functionality moved to DragHandle.tsx.

@TylerJDev
TylerJDev marked this pull request as ready for review July 14, 2026 20:41
@TylerJDev
TylerJDev requested a review from a team as a code owner July 14, 2026 20:41
@TylerJDev
TylerJDev requested review from Copilot and jonrohan July 14, 2026 20:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Exports PageLayout’s resizable-pane building blocks by extracting the drag interaction logic into a standalone DragHandle component and widening usePaneWidth to support usage outside of PageLayout.

Changes:

  • Extracted DragHandle into packages/react/src/PageLayout/DragHandle.tsx and wired it back into PageLayout.
  • Made usePaneWidth’s contentWrapperRef optional and added a shared aria-valuetext formatter hook-up path.
  • Added new public exports (top-level @primer/react and PageLayout subpath), plus a dev story demonstrating standalone usage.
Show a summary per file
File Description
packages/react/src/PageLayout/usePaneWidth.ts Makes contentWrapperRef optional and centralizes aria-valuetext formatting for DOM updates.
packages/react/src/PageLayout/PageLayout.tsx Replaces inline drag-handle logic with the extracted DragHandle component.
packages/react/src/PageLayout/DragHandle.tsx New standalone component implementing pointer/keyboard resize interactions.
packages/react/src/PageLayout/index.ts Expands PageLayout subpath exports to include resize primitives (and currently also exports paneUtils helpers).
packages/react/src/index.ts Re-exports usePaneWidth, defaultPaneWidth, DragHandle, and related types from PageLayout.
packages/react/src/PageLayout/PageLayout.dev.stories.tsx Adds a dev story demonstrating standalone resizable panel usage.
packages/react/src/PageLayout/PageLayout.dev.stories.module.css Adds styles for the standalone resizable panel dev story.
packages/react/src/tests/snapshots/exports.test.ts.snap Updates export snapshot to reflect newly added top-level exports/types.
.changeset/pagelayout-export-resize-primitives.md Adds a minor changeset for the new public exports.

Review details

  • Files reviewed: 9/9 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment thread packages/react/src/PageLayout/PageLayout.tsx Outdated
Comment thread packages/react/src/PageLayout/index.ts Outdated
@TylerJDev
TylerJDev requested a review from Copilot July 15, 2026 13:23
@github-actions
github-actions Bot requested a deployment to storybook-preview-8160 July 15, 2026 13:27 Abandoned

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

  • Files reviewed: 10/10 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment thread packages/react/src/PageLayout/usePaneWidth.ts
Comment thread packages/react/src/PageLayout/DragHandle.tsx

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

  • Files reviewed: 10/10 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment thread packages/react/src/PageLayout/usePaneWidth.ts
Comment thread packages/react/src/PageLayout/PageLayout.dev.stories.tsx

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

  • Files reviewed: 10/10 changed files
  • Comments generated: 4
  • Review effort level: Low

Comment thread packages/react/src/PageLayout/PageLayout.test.tsx Outdated
Comment thread packages/react/src/PageLayout/PageLayout.test.tsx
Comment thread packages/react/src/PageLayout/PageLayout.dev.stories.tsx
Comment thread packages/react/src/PageLayout/usePaneWidth.ts
TylerJDev and others added 4 commits July 15, 2026 14:53
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions
github-actions Bot requested a deployment to storybook-preview-8160 July 15, 2026 18:57 Abandoned
@github-actions
github-actions Bot temporarily deployed to storybook-preview-8160 July 15, 2026 19:08 Inactive
@primer-integration

primer-integration Bot commented Jul 16, 2026

Copy link
Copy Markdown

Integration test results from github/github-ui PR:

Passed  CI   Passed
Waiting  VRT   Waiting
Waiting  Projects   Waiting

@TylerJDev
TylerJDev added this pull request to the merge queue Jul 16, 2026
Merged via the queue into main with commit f8e7cf2 Jul 16, 2026
54 checks passed
@TylerJDev
TylerJDev deleted the tylerjdev/export-pagelayout-resizable branch July 16, 2026 20:08
@primer primer Bot mentioned this pull request Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Canary Release Apply this label when you want CI to create a canary release of the current PR integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants