Repository navigation
[HER-1012] Add secondary panel to BpkDrawer - #4848
Conversation
|
Visit https://backpack.github.io/storybook-prs/4848 to see this build running in a browser. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds optional dual-panel support to BpkDrawer by introducing a secondaryPanel prop and updating layout/styling so a second column can slide in alongside the primary drawer content.
Changes:
- Add
secondaryPanelAPI toBpkDrawer/BpkDrawerContentand render a secondary column when open. - Update drawer SCSS to support width transitions and dual-panel layout.
- Add Storybook example and tests covering secondary panel rendering and close interaction.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/backpack-web/src/bpk-component-drawer/src/BpkDrawerContent.tsx | Renders primary/secondary panel layout and adds dual-panel class toggling. |
| packages/backpack-web/src/bpk-component-drawer/src/BpkDrawerContent.module.scss | Adds width transition and flex-based two-column panel styles. |
| packages/backpack-web/src/bpk-component-drawer/src/BpkDrawer.tsx | Introduces exported SecondaryPanelProps and forwards secondaryPanel through. |
| packages/backpack-web/src/bpk-component-drawer/src/BpkDrawer.stories.js | Adds Storybook example demonstrating secondary panel usage. |
| packages/backpack-web/src/bpk-component-drawer/src/BpkDrawer-test.tsx | Adds tests for secondary panel render conditions and close callback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Visit https://backpack.github.io/storybook-prs/4848 to see this build running in a browser. |
1 similar comment
|
Visit https://backpack.github.io/storybook-prs/4848 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4848 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4848 to see this build running in a browser. |
Adds a `secondaryPanel` prop that renders a second column inside the drawer. The drawer expands to calc(var(--dynamic-width) * 2) via CSS transition to reveal the secondary content alongside the primary panel. No breaking changes to existing API. Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
581a01f to
2d6dca8
Compare
|
Visit https://backpack.github.io/storybook-prs/4848 to see this build running in a browser. |
|
|
||
| import type { ReactNode } from 'react'; | ||
|
|
||
| export type SecondaryPanelProps = { |
There was a problem hiding this comment.
Is there a way to keep the primary & secondary panel props in sync? Ideally we could have 'an array of drawers' that all render as 1 drawer one after the other :D
There was a problem hiding this comment.
Hi Gert! Thanks for your comment. It is a good idea to sync them, but!
The primary panel is structurally different from the secondary panel, a unified array shape would either force dialog-level props (dialogRef, closeOnScrimClick, mobileModalDisplay, isIpad, isIphone) onto every panel object where they'd never be used, or require a significant refactor of how BpkDrawer owns the dialog vs the panel content.
There was a problem hiding this comment.
For visibility: agreed to keep a single sub-panel. Thanks!
| </DrawerContainer> | ||
| ); | ||
|
|
||
| class DrawerWithSecondaryPanelContainer extends Component { |
There was a problem hiding this comment.
nit: just curious if there’s a particular reason you're leaning towards class components? I noticed that most of the recent stories in this file are using functional components and hooks. It might be worth considering a switch for the sake of consistency. What do you think? 😊
There was a problem hiding this comment.
Thanks Faye, good point! I modified it now
|
Visit https://backpack.github.io/storybook-prs/4848 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4848 to see this build running in a browser. |
| </div> | ||
| <div | ||
| role="complementary" | ||
| aria-label={secondaryPanel.ariaLabel ?? 'Secondary panel'} |
There was a problem hiding this comment.
Nit: the fallback Secondary panel is hardcoded English, which means consumers who don't pass ariaLabel silently get incorrect screen reader text in non-English contexts. Since a single complementary landmark doesn't require an accessible name, you can just drop the fallback:
- aria-label={secondaryPanel.ariaLabel ?? 'Secondary panel'}
+ aria-label={secondaryPanel.ariaLabel}
…_BpkDrawer' into HER-1012/Add_secondary_column_to_BpkDrawer
|
Visit https://backpack.github.io/storybook-prs/4848 to see this build running in a browser. |
…eTitle is set PR #4848 removed the ` ` spacer that was keeping the close button at the trailing end of the flex header when the title is visually hidden (position: absolute, so out of flex flow). With only one flex item and justify-content: space-between, the button fell back to flex-start (left). Fix: add margin-inline-start: auto to __close-button so it always pushes to the trailing edge — works for both the visible-title and hidden-title cases, and is RTL-safe via logical properties. Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
…itle is set (#4962) * [IRN-6874][BpkDrawer] Export SecondaryPanelProps from public index SecondaryPanelProps was added to Props in 43.7.0 but never re-exported from index.ts, causing TS2742 in consumers whose declaration emit needs a stable import path for the type. Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]> * [IRN-6874][BpkDrawer] Fix close button reverting to top-left when hideTitle is set PR #4848 removed the ` ` spacer that was keeping the close button at the trailing end of the flex header when the title is visually hidden (position: absolute, so out of flex flow). With only one flex item and justify-content: space-between, the button fell back to flex-start (left). Fix: add margin-inline-start: auto to __close-button so it always pushes to the trailing edge — works for both the visible-title and hidden-title cases, and is RTL-safe via logical properties. Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]> * [IRN-6874][BpkDrawer] Pin close control to trailing edge via header last-child Refine the earlier fix: instead of margin-inline-start on __close-button only, apply it to the header's last child. This also covers the closeText (BpkLink) variant, so hideTitle + closeText together no longer collapses the control to the leading edge. margin-inline-start: auto is RTL-safe — resolves to right in LTR and left in RTL. Verified in Storybook across default, hideTitle, closeText, and RTL. Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]> --------- Co-authored-by: Claude Sonnet 4.6 (1M context) <[email protected]>

Adds a
secondaryPanelprop that renders a second column inside the drawer. The drawer expands to calc(var(--dynamic-width) * 2) via CSS transition to reveal the secondary content alongside the primary panel. No breaking changes to existing API.Video:
trimed.mov
Remember to include the following changes:
[Clover-123][BpkButton] Updating the colourREADME.md(If you have created a new component)README.md