[CLOV-1327][BpkButton] Make corner radius themeable via CSS custom property#4265
[CLOV-1327][BpkButton] Make corner radius themeable via CSS custom property#4265Faye (Faye-Xiao) wants to merge 7 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR makes BpkButton corner radius runtime-themeable by switching border-radius to the existing utils.bpk-themeable-property pattern (token fallback + CSS custom property override) and registering a new buttonBorderRadius theming attribute.
Changes:
- Make
border-radiusthemeable via--bpk-button-border-radiusin the base button mixin and remove icon-only overrides that would block runtime theming. - Register
buttonBorderRadiusinbuttonThemeAttributesand update the corresponding unit test. - Replace Jest snapshots in
BpkButton-test.tsxwith explicit assertions and remove the obsolete snapshot file.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
packages/bpk-mixins/_buttons.scss |
Uses bpk-themeable-property for border-radius and removes icon-only border-radius overrides. |
packages/bpk-component-button/src/BpkButtonV2/BpkButton.module.scss |
Removes icon-only border-radius declarations so the CSS variable can take effect. |
packages/bpk-component-button/src/themeAttributes.ts |
Adds buttonBorderRadius to buttonThemeAttributes. |
packages/bpk-component-button/src/themeAttributes-test.ts |
Updates expectations for the new general theme attribute. |
packages/bpk-component-button/src/BpkButtonV2/BpkButton-test.tsx |
Replaces snapshots with explicit DOM/class assertions (but currently has a critical type-iteration issue). |
packages/bpk-component-button/src/BpkButtonV2/__snapshots__/BpkButton-test.tsx.snap |
Removes the obsolete snapshot file. |
specs/001-bpkbutton-baseline/spec.md |
Adds baseline/spec documentation for the change (currently contains incorrect CSS modifier names). |
specs/001-bpkbutton-baseline/styling-guide.md |
Adds styling guide documentation (currently inconsistent with actual PR scope/testing approach). |
specs/001-bpkbutton-baseline/research.md |
Adds research notes for the change. |
specs/001-bpkbutton-baseline/plan.md |
Adds implementation plan (currently includes a leaked local path artifact and outdated testing notes). |
specs/001-bpkbutton-baseline/api-design.md |
Documents the theme attribute addition and consumer usage. |
specs/001-bpkbutton-baseline/checklists/requirements.md |
Adds a spec quality checklist document. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/bpk-component-button/src/BpkButtonV2/BpkButton-test.tsx
Outdated
Show resolved
Hide resolved
|
Visit https://backpack.github.io/storybook-prs/4265 to see this build running in a browser. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Visit https://backpack.github.io/storybook-prs/4265 to see this build running in a browser. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Visit https://backpack.github.io/storybook-prs/4265 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4265 to see this build running in a browser. |
- Fix Object.keys → Object.values in BpkButton-test.tsx forEach loop so tests iterate over kebab-case type values (e.g. primary-on-dark) that match actual BEM class names, not camelCase keys - Remove unused ButtonType import (no longer needed after removing cast) - Update plan.md: replace "snapshot regeneration" with accurate description of explicit assertion approach; expand Files changed list to include test, snapshot deletion, and spec documentation artefacts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Visit https://backpack.github.io/storybook-prs/4265 to see this build running in a browser. |
Summary
Exposes
border-radiusas a runtime-configurable CSS custom property (--bpk-button-border-radius) using the sameutils.bpk-themeable-propertymechanism already used for button colours. No change to default appearance —tokens.$bpk-button-border-radiusremains the fallback.Changes
packages/bpk-mixins/_buttons.scss— replaced staticborder-radiusdeclaration in thebpk-buttonbase mixin with@include utils.bpk-themeable-property(border-radius, --bpk-button-border-radius, tokens.$bpk-button-border-radius); removed duplicate static declarations frombpk-button--icon-onlyandbpk-button--large-icon-onlymixins (which would otherwise override the CSS variable)packages/bpk-component-button/src/BpkButtonV2/BpkButton.module.scss— removed duplicate staticborder-radiusdeclarations from&--icon-onlyand&--large-icon-onlyselectors for the same reasonpackages/bpk-component-button/src/themeAttributes.ts— added'buttonBorderRadius'tobuttonThemeAttributesso consumers can apply it viabpk-themingtoMatchSnapshot()calls inBpkButton-test.tsxto explicitexpectassertions; removed obsolete snapshot file; updatedthemeAttributes-test.tsto reflect new attributeChecklist
[Clover-123][BpkButton] Updating the colourREADME.md(If you have created a new component)README.md— no README change needed (no new props or variants)border-radiusis a visual-only change; keyboard behaviour unchangedbuttonBorderRadiusis a new opt-in theme attribute