Skip to content
This repository was archived by the owner on Aug 5, 2026. It is now read-only.

[CLOV-1376][BpkDivider] Add new divider component - #4902

Merged
Iris Li (wpe1arhy) merged 9 commits into
mainfrom
CLOV-1376_add_divider_component_to_bpk
Jul 17, 2026
Merged

Iris Li (wpe1arhy) merged 9 commits into
mainfrom
CLOV-1376_add_divider_component_to_bpk

Conversation

@wpe1arhy

@wpe1arhy Iris Li (wpe1arhy) commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a new BpkDivider component — 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

Property PropType Required Default
orientation 'horizontal' | 'vertical' No 'horizontal'
spacing 'none' | 'base' | 'lg' No 'none'
weight 'default' | 'bold' No 'default'

spacing mapping

Applied as margin along the divider's main axis (block margin when horizontal, inline margin when vertical).

Value Token Actual value
none — 0
base tokens.bpk-spacing-base() 1rem (16px)
lg tokens.bpk-spacing-lg() 1.5rem (24px)

weight mapping

Controls the line thickness, driven through the --bpk-divider-thickness CSS custom property (height when horizontal, width when vertical).

Value Token Actual value
default tokens.$bpk-border-size-sm 1px
bold tokens.$bpk-border-size-lg 2px

Remember to include the following changes:

  • Ensure the PR title includes the name of the component you are changing so it's clear in the release notes for consumers of the changes in the version e.g [Clover-123][BpkButton] Updating the colour
  • README.md (If you have created a new component)
  • Component README.md
  • Tests
  • Accessibility tests
    • The following checks were performed:
      • Ability to navigate using a keyboard only
      • Zoom functionality (Deque University explanation):
        • The page SHOULD be functional AND readable when only the text is magnified to 200% of its initial size
        • Pages must reflow as zoom increases up to 400% so that content continues to be presented in only one column i.e. Content MUST NOT require scrolling in two directions (both vertically and horizontally)
      • Ability to navigate using a screen reader only
  • Storybook examples created/updated
  • For breaking changes or deprecating components/properties, migration guides added to the description of the PR. If the guide has large changes, consider creating a new Markdown page inside the component's docs folder and link it here

Copilot AI review requested due to automatic review settings July 15, 2026 06:38
@wpe1arhy Iris Li (wpe1arhy) added the minor Non breaking change label Jul 15, 2026
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

@skyscanner-backpack-bot

skyscanner-backpack-bot Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor
Warnings
⚠️

Physical CSS properties are not RTL-safe. Prefer logical equivalents (inset-inline-, margin-inline-, padding-inline-, border-inline-, border-start-start-radius, text-align: start/end). Offending lines:

  • packages/backpack-web/src/bpk-component-divider/src/BpkDivider.module.scss:
    width: 100%;
    height: var(--bpk-divider-thickness);
      margin-top: var(--bpk-spacing-base, tokens.bpk-spacing-base());
      margin-bottom: var(--bpk-spacing-base, tokens.bpk-spacing-base());
      margin-top: var(--bpk-spacing-lg, tokens.bpk-spacing-lg());
      margin-bottom: var(--bpk-spacing-lg, tokens.bpk-spacing-lg());
    width: var(--bpk-divider-thickness);
    height: 100%;

Browser support

If this is a visual change, make sure you've tested it in multiple browsers.

Generated by 🚫 dangerJS against 404ec99

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

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

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 BpkDivider component 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.

Comment on lines +37 to +41
| Property | PropType | Required | Default |
| ----------- | --------------------------------- | -------- | -------------- |
| orientation | 'horizontal' \| 'vertical' | false | 'horizontal' |
| spacing | 'none' \| 'base' \| 'lg' | false | 'none' |
| weight | 'default' \| 'bold' | false | 'default' |

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The table uses single pipes (|), not || (see lines 37–41) — it renders correctly, so no change needed.

Comment on lines +18 to +21
import figma from "@figma/code-connect"

import BpkDivider from "./BpkDivider"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This matches the repo convention for .figma.tsx files (e.g. BpkButton.figma.tsx) and passes eslint cleanly, so it won't fail lint.

Comment on lines +28 to +47
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} />
),
},
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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]>
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Iris Li (wpe1arhy) and others added 2 commits July 15, 2026 15:13
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]>
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@xiaogliu Vincent Liu (xiaogliu) 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.

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 />);

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.

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();
});

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Updated in 44a95c2

// 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",

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.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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]>
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

}

&.bpk-divider--spacing-lg {
margin-top: tokens.bpk-spacing-lg();

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.

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]>
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@xiaogliu Vincent Liu (xiaogliu) 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.

LGTM

@wpe1arhy
Iris Li (wpe1arhy) merged commit 99f7006 into main Jul 17, 2026
16 checks passed
@wpe1arhy
Iris Li (wpe1arhy) deleted the CLOV-1376_add_divider_component_to_bpk branch July 17, 2026 02:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

minor Non breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants