Migrate Button to ButtonComposed (batch 7)#96731
Conversation
Guccio163
left a comment
There was a problem hiding this comment.
Good work, leaving 2 nitpicks to include in the description; One more thing: Note: this button renders slightly differently from the production build (left/right padding), and that's expected/acceptable. in one of the test-step suites is a very good idea but should be defined clearly, describing exactly where are the mismatches and how big, f.ex. 'Production has 8px gap and should be 4px'. Beside that, LGTM 👍
| <Button.Text>{translate('bankAccount.addBankAccount')}</Button.Text> | ||
| <Button.Icon | ||
| src={icons.ArrowRight} | ||
| style={styles.mlAuto} |
There was a problem hiding this comment.
I'd be worth noting in the PR that we added this style as it is required to style the button correctly and it's an exception, just a comment in the PR description
| @@ -946,7 +946,7 @@ const staticStyles = (theme: ThemeColors) => | |||
| }, | |||
|
|
|||
| buttonCTAIcon: { | |||
| marginRight: 22, | |||
| marginRight: 18, | |||
There was a problem hiding this comment.
Leave a note in the PR description that you're changing that because this is a custom style used only in 1 place and we are decreasing it by 1 to account for 4px constant gap , that sums up with this 18px to previous value of 22px.
Explanation of Change
This is batch 7 (PR7 of 9) of the effort to migrate every direct
<Button>usage (import Button from '@components/Button') over to the composedButtonComposed, so the oldButtoncan be deprecated. This batch is the "text + icon · styled" shape. 38 files / 59 instances were listed for this batch; 2 needed no change (MoneyReportHeaderSecondaryActions.tsxwas already migrated via #93789;SpendOverTimeSectionContent.tsxno longer has a<Button>), so this PR touches 36 files.Fixed Issues
$ #95176
PROPOSAL: #83762 (comment)
Tests
For every migrated button, verify that behaviour is unchanged from before the migration:
success= green,danger= red, default = grey.isLoading).<Button.KeyboardShortcut>).Moreover, I divided migrated buttons into several categories, based on their custom styling or behavior which is applied in the application:
SetupMethodlayout fix)LinkButton— link-styled text + icon with a hover color (desktop only)iconWrapperStyles→contentContainerStyle, plussuccessmapped to a conditionalvariantFor each of these categories, detailed test steps are described in sections below:
Plain left-icon + text button
Preconditions
Test steps
Expected behavior
The Add category button renders the Plus icon immediately left of the label (grouped, not split), is a green success button, and matches the rendering from a production build; pressing it opens the create-category page.
Full-width CTA with a right-edge icon
Preconditions
Test steps
/settings/wallet/enable-payments/add-bank-account, or navigate Account menu (avatar) > Wallet > Enable wallet.Expected behavior
The left Bank icon + "Add bank account" text are grouped on the left, and the ArrowRight icon is pinned to the far-right edge.
Right-side icon on a content-width button
Preconditions
None beyond a normal account.
Test steps
Expected behavior
Show more renders with the down-arrow directly to its right, centered on the divider line, matching production.
LinkButton — "Columns" (desktop web only)
Preconditions
Test steps
Expected behavior
At rest the "Columns" text is link-blue and its icon is the same blue; on hover both shift to the hover-blue; clicking opens the column-selection page. Matches production.
Content-container constraint + conditional variant (free-trial pill)
Preconditions
Test steps
Expected behavior
The pill renders with the Star icon + trial text, the content stays constrained to the pill. Matches production in both wide and narrow placement.
Offline tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari