-
Notifications
You must be signed in to change notification settings - Fork 203
[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
Conversation
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, |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
Visit https://backpack.github.io/storybook-prs/3869 to see this build running in a browser. |
Visit https://backpack.github.io/storybook-prs/3869 to see this build running in a browser. |
Visit https://backpack.github.io/storybook-prs/3869 to see this build running in a browser. |
There was a problem hiding this 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 thekeyline
prop with a default oftrue
. - 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 {
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, | |||
}; |
There was a problem hiding this comment.
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? 🙇♀️
There was a problem hiding this comment.
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> | ||
); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -54,6 +54,28 @@ describe('BpkPanel', () => { | |||
expect(asFragment()).toMatchSnapshot(); | |||
}); | |||
|
|||
it('should render with no keyline when attribute is false', () => { |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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;
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Visit https://backpack.github.io/storybook-prs/3869 to see this build running in a browser. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 🚀
Approved the Percy failure https://percy.io/09e69e44/web/backpack/builds/41387263?utm_campaign=09e69e44&utm_content=backpack&utm_source=github_status_public as that's what we expected. |
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:
[Clover-123][BpkButton] Updating the colour
README.md
(If you have created a new component)README.md