Skip to content

[IRN-5969][BpkPanel] panel keyline #3869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 8, 2025
Merged

[IRN-5969][BpkPanel] panel keyline #3869

merged 8 commits into from
Jul 8, 2025

Conversation

jimmycook
Copy link
Contributor

  • keyline changes
  • typescript

We're adding a keyline prop to the panel component, on by default, that can be disabled.3

Also moving the component to typescript.

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

@jimmycook jimmycook added the minor Non breaking change label Jul 3, 2025
@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/3869 to see this build running in a browser.

padded?: boolean,
fullWidth?: boolean,
className?: string | null,
keyline?: boolean,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Core of the change, this prop, on by default


if (padded) {
classNames.push(getClassName('bpk-panel--padded'));
}
if (fullWidth) {
classNames.push(getClassName('bpk-panel--full-width'));
}
if (keyline) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Decide which keyline class to use based on full width or not

@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/3869 to see this build running in a browser.

@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/3869 to see this build running in a browser.

@skyscanner-backpack-bot
Copy link

skyscanner-backpack-bot bot commented Jul 3, 2025

Warnings
⚠️

Package source files (e.g. packages/package-name/src/Component.js) were updated, but snapshots weren't. Have you checked that the tests still pass?

Browser support

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

Generated by 🚫 dangerJS against c2a36d7

@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/3869 to see this build running in a browser.

@Faye-Xiao Faye-Xiao requested a review from Copilot July 4, 2025 06:08
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a new keyline prop (enabled by default, can be disabled) to the BpkPanel component and converts it to TypeScript.

  • Introduces two new SCSS mixins for keyline support.
  • Updates BpkPanel.tsx to define and use the keyline prop with a default of true.
  • Updates tests, snapshots, CSS modules, and Storybook examples to cover the new behavior.

Reviewed Changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/bpk-mixins/_panels.scss Adds bpk-panel--keyline and bpk-panel--full-width-keyline mixins
packages/bpk-component-panel/src/BpkPanel.tsx Ports to TypeScript, defines Props, and implements keyline logic
packages/bpk-component-panel/src/BpkPanel.module.scss Adds new CSS module classes for keyline variants
packages/bpk-component-panel/src/snapshots/BpkPanel-test.tsx.snap Updates snapshots to include keyline classes
packages/bpk-component-panel/src/BpkPanel-test.tsx Adds tests for disabling keyline in both normal and full-width modes
examples/bpk-component-panel/stories.js Exposes a NoKeyline Storybook story
examples/bpk-component-panel/examples.js Adds NoKeylineExample to the live examples
Comments suppressed due to low confidence (1)

packages/bpk-mixins/_panels.scss:92

  • The @mixin bpk-panel--full-width-keyline definition is missing a closing }. Without it, the stylesheet will fail to compile.
@mixin bpk-panel--full-width-keyline {

@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/3869 to see this build running in a browser.

@@ -58,4 +68,5 @@ export {
WithoutPaddingExample,
FullWidthExample,
MixedExample,
NoKeylineExample,
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for converting the related code to TS!
Could you also convert the example and stories files to TS? 🙇‍♀️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in next commit

consectetur, dolor nec vulputate vehicula, ex metus mattis ante, non dictum
mi ante eu arcu.
</BpkPanel>
);
Copy link
Contributor

@Faye-Xiao Faye-Xiao Jul 4, 2025

Choose a reason for hiding this comment

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

Hi @jimmycook could you add a container with a non-white background for this BpkPanel as it's a little hard to see its visual on a white background?

  • How it looks like on your storybook case
    Screenshot 2025-07-04 at 14 24 08

  • visual spec
    Screenshot 2025-07-04 at 14 24 33

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!
image

@@ -54,6 +54,28 @@ describe('BpkPanel', () => {
expect(asFragment()).toMatchSnapshot();
});

it('should render with no keyline when attribute is false', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: 'should render BpkPanel without keyline when keyline attribute is false'

dis parturient montes, nascetur ridiculus mus.
</BpkPanel>,
);
expect(asFragment()).toMatchSnapshot();
Copy link
Contributor

Choose a reason for hiding this comment

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

We do not recommend using snapshot testing. Could you use jest expect instead? 🙇‍♀️

TLDR: Avoid using snapshots for testing components where possible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed all of these

dis parturient montes, nascetur ridiculus mus.
</BpkPanel>,
);
expect(asFragment()).toMatchSnapshot();
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as comment r2184540978

fullWidth = false,
keyline = true,
padded = true,
...rest
Copy link
Contributor

@Faye-Xiao Faye-Xiao Jul 4, 2025

Choose a reason for hiding this comment

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

It looks like the rest type definition is missing in Props .

Could you add a type for it?

e.g.

export type Props = {
...
[rest: string]: any;
...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/3869 to see this build running in a browser.

Copy link
Contributor

@Faye-Xiao Faye-Xiao left a comment

Choose a reason for hiding this comment

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

LGTM. 🚀

@Faye-Xiao
Copy link
Contributor

@Faye-Xiao Faye-Xiao merged commit a3d166c into main Jul 8, 2025
10 checks passed
@Faye-Xiao Faye-Xiao deleted the IRN-5969-panel-keyline branch July 8, 2025 02:52
@Faye-Xiao Faye-Xiao added V38 Planned this change in V38 version and removed V38 Planned this change in V38 version labels Jul 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Non breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants