feat: Add data component attributes - Phase 4: Buttons and Links#4181
Conversation
Phase 4/11 of data-backpack-ds-component migration This phase adds data-backpack-ds-component attributes to buttons and links components.
There was a problem hiding this comment.
Pull request overview
Adds data-backpack-ds-component attributes to button and link components as part of Phase 4 of the data component attributes initiative. This enables better component identification and tracking across the design system.
Changes:
- Added
data-backpack-ds-componentattributes to all button and link components - Updated test snapshots to reflect the new data attributes
- Imported
getDataComponentAttributeutility across affected components
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/bpk-component-button/src/BpkButtonV2/BpkButton.tsx | Added data attribute to button and anchor elements |
| packages/bpk-component-link/src/BpkLink.tsx | Added data attribute to link component |
| packages/bpk-component-link/src/BpkButtonLink.tsx | Added data attribute to button link component |
| packages/bpk-component-loading-button/src/BpkLoadingButton.tsx | Added data attribute to loading button component |
| packages/bpk-component-card-button/src/BpkSaveButton.tsx | Added data attribute to save button component |
| packages/bpk-component-swap-button/src/BpkSwapButton.tsx | Added data attribute to swap button container |
| packages/bpk-component-rtl-toggle/src/BpkRtlToggle.tsx | Added data attribute to RTL toggle component |
| packages/bpk-component-theme-toggle/src/BpkThemeToggle.tsx | Added data attribute to theme toggle container |
| packages/bpk-component-button/src/BpkButtonV2/snapshots/BpkButton-test.tsx.snap | Updated snapshots with new data attributes |
| packages/bpk-component-link/src/snapshots/BpkButtonLink-test.tsx.snap | Updated snapshots with new data attributes |
| packages/bpk-component-loading-button/src/snapshots/BpkLoadingButton-test.tsx.snap | Updated snapshots with new data attributes |
| packages/bpk-component-card-button/src/snapshots/BpkSaveButton-test.tsx.snap | Updated snapshots with new data attributes |
| packages/bpk-component-swap-button/src/snapshots/BpkSwapButton-test.tsx.snap | Updated snapshots with new data attributes |
| packages/bpk-component-rtl-toggle/src/snapshots/BpkRtlToggle-test.tsx.snap | Updated snapshots with new data attributes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Visit https://backpack.github.io/storybook-prs/4181 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4181 to see this build running in a browser. |
|
Copilot open a new pull request to apply changes based on the comments in this thread |
|
Gert-Jan Vercauteren (@gert-janvercauteren) I've opened a new pull request, #4194, to work on those changes. Once the pull request is ready, I'll request review from you. |
…orrections (#4194) * Initial plan * fix: Remove extra spaces in import statements (BpkButton, BpkRtlToggle) Co-authored-by: gert-janvercauteren <728889+gert-janvercauteren@users.noreply.github.com> * fix: Remove extra space and trailing whitespace in BpkLoadingButton.tsx * fix: Remove extra space and trailing whitespace in BpkLoadingButton.tsx Co-authored-by: gert-janvercauteren <728889+gert-janvercauteren@users.noreply.github.com> * chore: Add .copilot-progress to .gitignore Co-authored-by: gert-janvercauteren <728889+gert-janvercauteren@users.noreply.github.com> * Update BpkRtlToggle.tsx --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: gert-janvercauteren <728889+gert-janvercauteren@users.noreply.github.com> Co-authored-by: Gert-Jan Vercauteren <gert-jan.vercauteren@skyscanner.net>
|
Visit https://backpack.github.io/storybook-prs/4181 to see this build running in a browser. |
| type={submit ? 'submit' : 'button'} | ||
| disabled={disabled} | ||
| className={classNames} | ||
| className={classNames} {...getDataComponentAttribute('Button')} |
There was a problem hiding this comment.
Could Copilot help to split the lines?
| disabled={showBtnDisabled} | ||
| size={large ? SIZE_TYPES.large : SIZE_TYPES.small} | ||
| type={type} | ||
| {...getDataComponentAttribute('LoadingButton')} |
There was a problem hiding this comment.
I’ve noticed there's an inconsistent indentation. It’s making me wonder if our linter is thorough enough.
There was a problem hiding this comment.
It's not, working on it :[
Move getDataComponentAttribute spread to its own line for better readability in multi-line prop lists. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Visit https://backpack.github.io/storybook-prs/4181 to see this build running in a browser. |
34b6146
into
main
Summary
Adds
data-backpack-ds-componentattributes to Buttons and LinksPhase 4 of 11
Interactive button and link elements
Related
Type of Change
Testing
Checklist