Skip to content

fix: refactor Button and IconButton to children-based API#1281

Merged
arkadiy93 merged 13 commits into
mainfrom
fix/buttonsRequestedChanges
May 11, 2026
Merged

fix: refactor Button and IconButton to children-based API#1281
arkadiy93 merged 13 commits into
mainfrom
fix/buttonsRequestedChanges

Conversation

@arkadiy93
Copy link
Copy Markdown
Contributor

Azure DevOps links

Task

Copilot AI review requested due to automatic review settings May 7, 2026 09:00
Copy link
Copy Markdown
Contributor

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

Refactors the library’s custom Button and IconButton components to use a children-based content API (instead of label / leadingIcon / trailingIcon) and updates downstream usages (TopBar, Toast, FileUploadArea, stories) accordingly. It also changes TanStack Router link usage to be passed via linkOptions and bumps the package version.

Changes:

  • Refactor Button and IconButton to render content via children, and introduce linkOptions for router-link rendering.
  • Update component call sites and Storybook stories to the new API (including icon rendering via @equinor/eds-core-react Icon).
  • Add new content wrappers / adjust button styles to support the new children-based layout and loading state.

Reviewed changes

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

Show a summary per file
File Description
src/organisms/TopBar/Resources/ReleaseNotesDialog/ReleaseNotesDialog.tsx Updates link button usage to linkOptions + children text.
src/organisms/TopBar/Account/ImpersonateMenu/DeleteUser/DeleteUser.tsx Updates action buttons to children-based content and inlines EDS Icon.
src/organisms/TopBar/Account/Account.tsx Updates logout button to children-based content and inlines EDS Icon.
src/organisms/SideSheet/SideSheet.stories.tsx Migrates Storybook usage from label to children.
src/organisms/ReleaseNote/ToggleExpanded.tsx Migrates toggle button to children-based label + icon.
src/organisms/Card/Card.stories.tsx Migrates card action buttons from label to children.
src/molecules/Toast/Toast.tsx Migrates toast action button from label to children.
src/molecules/RichTextEditor/custom-extensions/Counter.tsx Migrates example button content from label to children with interpolation.
src/molecules/FileUploadArea/FileUploadArea.tsx Migrates “Browse files” button to children-based icon + text.
src/molecules/Divider/Divider.stories.tsx Migrates story usage from label to children.
src/molecules/Dialog/DialogAction.tsx Migrates dialog action to children-based icon + text rendering.
src/molecules/Confetti/Confetti.stories.tsx Migrates story usage from label to children.
src/molecules/Button/types.ts Adjusts button common types (ref typing change).
src/molecules/Button/IconButton/IconButton.tsx Refactors link handling to linkOptions and updates typing strategy.
src/molecules/Button/IconButton/IconButton.stories.tsx Updates icon button link stories to use linkOptions.
src/molecules/Button/ContentWrapper.tsx Adds new wrappers to layout children-based button content.
src/molecules/Button/Button.tsx Refactors button API to children and linkOptions; removes label/icon props.
src/molecules/Button/Button.styles.ts Updates styles to align with children-based rendering and loading overlay.
src/molecules/Button/Button.stories.tsx Updates stories to use children-based API and linkOptions.
src/molecules/Banner/Banner.stories.tsx Updates banner story to use children-based button.
package.json Bumps package version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/molecules/Button/ContentWrapper.tsx Outdated
Comment thread src/molecules/Button/ContentWrapper.tsx Outdated
Comment thread src/molecules/Button/Button.styles.ts
Comment thread src/molecules/Button/IconButton/IconButton.tsx
Comment thread src/organisms/ReleaseNote/ToggleExpanded.tsx
Comment thread src/molecules/RichTextEditor/custom-extensions/Counter.tsx
Comment thread package.json
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 100% (🎯 100%) 17397 / 17397
🔵 Statements 100% (🎯 100%) 17397 / 17397
🔵 Functions 100% (🎯 100%) 1278 / 1278
🔵 Branches 100% (🎯 100%) 4445 / 4445
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/molecules/Button/Button.styles.ts 100% 100% 100% 100%
src/molecules/Button/Button.tsx 100% 100% 100% 100%
src/molecules/Button/types.ts 100% 100% 100% 100%
src/molecules/Button/IconButton/IconButton.tsx 100% 100% 100% 100%
src/molecules/Dialog/Dialog.tsx 100% 100% 100% 100%
src/molecules/Dialog/DialogAction.tsx 100% 100% 100% 100%
src/molecules/FileUploadArea/FileUploadArea.tsx 100% 100% 100% 100%
src/molecules/RichTextEditor/custom-extensions/Counter.tsx 100% 100% 100% 100%
src/molecules/Toast/Toast.tsx 100% 100% 100% 100%
src/organisms/ReleaseNote/ToggleExpanded.tsx 100% 100% 100% 100%
src/organisms/TopBar/Account/Account.tsx 100% 100% 100% 100%
src/organisms/TopBar/Account/ImpersonateMenu/DeleteUser/DeleteUser.tsx 100% 100% 100% 100%
src/organisms/TopBar/Resources/ReleaseNotesDialog/ReleaseNotesDialog.tsx 100% 100% 100% 100%
Generated in workflow #2309 for commit b3a4766 by the Vitest Coverage Report Action

Copilot AI review requested due to automatic review settings May 7, 2026 10:17
Comment thread package.json
Comment thread src/molecules/Button/ContentWrapper.tsx Outdated
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.

Comment thread package.json
Comment thread src/molecules/Button/Button.tsx Outdated
Comment thread src/molecules/Button/IconButton/IconButton.tsx Outdated
Comment thread src/molecules/Button/IconButton/IconButton.tsx Outdated
@arkadiy93 arkadiy93 requested review from mariush2 and yunarch May 7, 2026 10:48
@arkadiy93 arkadiy93 marked this pull request as ready for review May 7, 2026 10:48
@arkadiy93 arkadiy93 requested a review from a team as a code owner May 7, 2026 10:48
Copilot AI review requested due to automatic review settings May 7, 2026 10:48
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.

Comment thread src/molecules/Button/Button.styles.ts
Comment thread src/molecules/Button/types.ts
Comment thread src/molecules/Button/Button.tsx
Comment thread package.json
Comment thread src/molecules/Button/ContentWrapper.tsx Outdated
mariush2
mariush2 previously approved these changes May 7, 2026
Copy link
Copy Markdown
Contributor

@mariush2 mariush2 left a comment

Choose a reason for hiding this comment

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

Saw Adrian's comment about the Children usage and it sort of makes senes to me. Might be worth looking at changing it to something that isn't considered legacy by react

Copilot AI review requested due to automatic review settings May 8, 2026 06:48
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

src/molecules/Button/Button.styles.ts:93

  • CenteredContent is position: absolute with width/height: 100% but no inset (top/left/right/bottom). This can leave the loading indicator positioned at its static position rather than overlaying the full button.

Suggested fix: set inset: 0 (or at least top: 0; left: 0) so the loader reliably centers over the button content.

export const CenteredContent = styled.span`
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;

Comment thread src/molecules/Button/types.ts
Comment thread src/molecules/Button/Button.tsx
Comment thread src/molecules/Button/IconButton/IconButton.tsx
Comment thread package.json
@arkadiy93 arkadiy93 requested a review from yunarch May 8, 2026 07:05
Copilot AI review requested due to automatic review settings May 8, 2026 13:20
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.

Comment thread src/molecules/Button/Button.styles.ts Outdated
Comment thread src/molecules/Button/types.ts
Comment thread package.json
@arkadiy93 arkadiy93 merged commit eec5aef into main May 11, 2026
11 checks passed
@arkadiy93 arkadiy93 deleted the fix/buttonsRequestedChanges branch May 11, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants