Repository navigation
[CLOV-1376][BpkDivider] Add new divider component - #4902
Conversation
|
Visit https://backpack.github.io/storybook-prs/4902 to see this build running in a browser. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 007b0cf3fb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
Browser supportIf this is a visual change, make sure you've tested it in multiple browsers. |
|
Visit https://backpack.github.io/storybook-prs/4902 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 a new BpkDivider component to Backpack Web, including styling, docs, Storybook examples, tests, and Figma Code Connect integration.
Changes:
- Introduces the
BpkDividercomponent with horizontal/vertical orientation, spacing, and weight variants. - Adds Storybook stories, unit + accessibility tests, and snapshot coverage.
- Registers the component in Figma Code Connect config and provides a Figma mapping file.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/backpack-web/src/bpk-component-divider/src/accessibility-test.tsx | Adds jest-axe accessibility test for the new divider component. |
| packages/backpack-web/src/bpk-component-divider/src/snapshots/BpkDivider-test.tsx.snap | Adds snapshot baseline for default divider rendering. |
| packages/backpack-web/src/bpk-component-divider/src/BpkDivider.tsx | Implements BpkDivider with semantic <hr> (horizontal) and ARIA separator (vertical). |
| packages/backpack-web/src/bpk-component-divider/src/BpkDivider.stories.tsx | Adds Storybook examples for variants + dark mode + visual test story. |
| packages/backpack-web/src/bpk-component-divider/src/BpkDivider.module.scss | Defines divider styling and variant modifiers. |
| packages/backpack-web/src/bpk-component-divider/src/BpkDivider.figma.tsx | Adds Figma Code Connect mapping for divider props. |
| packages/backpack-web/src/bpk-component-divider/src/BpkDivider-test.tsx | Adds unit tests for rendering and variant behavior. |
| packages/backpack-web/src/bpk-component-divider/index.ts | Exposes public entrypoint and prop type export. |
| packages/backpack-web/src/bpk-component-divider/README.md | Documents installation/usage and props for the new component. |
| figma.config.json | Registers divider module path for Figma Code Connect resolution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| | Property | PropType | Required | Default | | ||
| | ----------- | --------------------------------- | -------- | -------------- | | ||
| | orientation | 'horizontal' \| 'vertical' | false | 'horizontal' | | ||
| | spacing | 'none' \| 'base' \| 'lg' | false | 'none' | | ||
| | weight | 'default' \| 'bold' | false | 'default' | |
There was a problem hiding this comment.
The table uses single pipes (|), not || (see lines 37–41) — it renders correctly, so no change needed.
| import figma from "@figma/code-connect" | ||
|
|
||
| import BpkDivider from "./BpkDivider" | ||
|
|
There was a problem hiding this comment.
This matches the repo convention for .figma.tsx files (e.g. BpkButton.figma.tsx) and passes eslint cleanly, so it won't fail lint.
| figma.connect( | ||
| BpkDivider, | ||
| "https://www.figma.com/design/KXf2gHNLDe2cXWUoHl4cTX/Backpack%E2%80%A8Foundations---Components?node-id=21653-57904", | ||
| { | ||
| props: { | ||
| spacing: figma.enum("Padding", { | ||
| NoSpace: "none", | ||
| Base: "base", | ||
| Large: "lg", | ||
| }), | ||
| weight: figma.enum("Weight", { | ||
| "1px": "default", | ||
| "2px": "bold", | ||
| }), | ||
| }, | ||
| example: ({ spacing, weight }) => ( | ||
| <BpkDivider spacing={spacing} weight={weight} /> | ||
| ), | ||
| }, | ||
| ) |
There was a problem hiding this comment.
Same as above — this is the established .figma.tsx convention across the repo and passes eslint cleanly.
Vertical dividers used height: 100%, which collapses to 0 in an auto-height flex row where the parent has no definite height. Add align-self: stretch so the vertical variant fills the cross-axis height out of the box. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Visit https://backpack.github.io/storybook-prs/4902 to see this build running in a browser. |
bpk-storybook-utils ships no type declarations, so importing it trips TS7016 under the root typecheck. Add the // @ts-expect-error line other stories use, matching decisions/imports-ts-suppressions.md. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Visit https://backpack.github.io/storybook-prs/4902 to see this build running in a browser. |
Vincent Liu (xiaogliu)
left a comment
There was a problem hiding this comment.
A few minor, non-blocking findings from review. Nice, clean component overall.
Root README.md component list missing the divider entry — the top-level README.md maintains a manually-curated, alphabetically-sorted component index (not auto-generated). It currently goes straight from bpk-component-dialog to bpk-component-drawer; a [\bpk-component-divider`](/packages/backpack-web/src/bpk-component-divider)` entry should be inserted between them.
|
|
||
| describe('BpkDivider accessibility tests', () => { | ||
| it('should not have programmatically-detectable accessibility issues', async () => { | ||
| const { container } = render(<BpkDivider />); |
There was a problem hiding this comment.
The a11y test only covers the horizontal (default) variant. The vertical variant renders an entirely different DOM branch (<div role="separator" aria-orientation="vertical">), which is the path most worth an axe check. Consider adding:
it('vertical divider has no a11y issues', async () => {
const { container } = render(<BpkDivider orientation="vertical" />);
expect(await axe(container)).toHaveNoViolations();
});| // map it here via `figma.enum("Orientation", { ... })`. | ||
| figma.connect( | ||
| BpkDivider, | ||
| "https://www.figma.com/design/KXf2gHNLDe2cXWUoHl4cTX/Backpack%E2%80%A8Foundations---Components?node-id=17423-70360", |
There was a problem hiding this comment.
Figma node-id mismatch: this Code Connect URL points at node-id=21653-57904, while the PR description links node-id=10858-59662. Likely intentional (frame vs. component node), but worth a quick confirm that Code Connect targets the right node.
There was a problem hiding this comment.
Updated the link in the description to point to the component set as well.
Address review feedback: - Add a jest-axe test covering the vertical variant, which renders a distinct `<div role="separator">` DOM branch not previously exercised. - Add the missing bpk-component-divider entry to the root README's manually-curated component index (between dialog and drawer). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Visit https://backpack.github.io/storybook-prs/4902 to see this build running in a browser. |
| } | ||
|
|
||
| &.bpk-divider--spacing-lg { | ||
| margin-top: tokens.bpk-spacing-lg(); |
There was a problem hiding this comment.
All token name should also using the fallback format like what you wrote here https://github.com/Skyscanner/backpack/pull/4902/changes#diff-5e5d4f926ba495847387712a9a72c359696c7492e7ff140a58d0cba580c511b4R26
More example in this PR. https://github.com/Skyscanner/backpack/pull/4865/changes#diff-16589eebef0dbcf290ebf67b8f4033c9c7102079b3045dd1f94b3a5f4da185c6R28
Wrap every SASS token in `var(--bpk-*, <sass-fallback>)`, aligning with the existing `--bpk-other-line-default` line colour and the wider Backpack CSS variable system. Reuses existing primitives (no new variables): - $bpk-border-size-sm/lg -> --bpk-border-1/2 - bpk-spacing-base()/lg() -> --bpk-spacing-base/lg Purely a token-plumbing change; primitive values are theme-invariant so there is no visual change, and the SASS fallbacks preserve behaviour where CSS variables are unavailable. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Visit https://backpack.github.io/storybook-prs/4902 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4902 to see this build running in a browser. |
Summary
Adds a new
BpkDividercomponent — a thin line used to group or separate content.Renders a semantic
<hr>for horizontal dividers and a<div role="separator">for vertical ones, so both orientations are announced correctly by assistive tech.Figma link: https://www.figma.com/design/KXf2gHNLDe2cXWUoHl4cTX/Backpack%E2%80%A8Foundations---Components?node-id=17423-70360&p=f
BpkDivider Props
orientation'horizontal' | 'vertical''horizontal'spacing'none' | 'base' | 'lg''none'weight'default' | 'bold''default'spacing mapping
Applied as margin along the divider's main axis (block margin when horizontal, inline margin when vertical).
none0basetokens.bpk-spacing-base()1rem(16px)lgtokens.bpk-spacing-lg()1.5rem(24px)weight mapping
Controls the line thickness, driven through the
--bpk-divider-thicknessCSS custom property (heightwhen horizontal,widthwhen vertical).defaulttokens.$bpk-border-size-sm1pxboldtokens.$bpk-border-size-lg2pxRemember to include the following changes:
[Clover-123][BpkButton] Updating the colourREADME.md(If you have created a new component)README.md